开发者

UIMenuController - customization

开发者 https://www.devze.com 2023-01-12 09:51 出处:网络
As os 3.2, we are allowed to change the editing menu. This is what the documentation states: \"You may create your own menu items, each with its own title and action selector, and add them to the edi

As os 3.2, we are allowed to change the editing menu. This is what the documentation states:

"You may create your own menu items, each with its own title and action selector, and add them to the editing menu through this property. Custom items appear in the menu after any system menu it开发者_开发百科ems."

I would like to remove those 'system items' (they are a lot!), or part of them. What should I do?


You control which ones are visible with canPerformAction, such as:

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
    BOOL answer = NO;

    if (action == @selector(copy:))
        answer = YES;

    return answer;
}

The above code will allow the copy, but none of the others. You can also add in your custom UIMenuItem too.

0

精彩评论

暂无评论...
验证码 换一张
取 消