1
votes

I have added my own MenuItem to UIMenuController.But the problem is that it is also showing some default items like copy, paste etc. I want to remove these items and want to display my own menu item. I have also tried this code

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    BOOL can = [super canPerformAction:action withSender:sender];

    if (action == @selector(showMyAlert:) )
    {
        can = YES;
    }
    if (action == @selector(paste:))
    {
        can = NO;
    }
    return can;
}

Here is the image.Paste item is showing along with my own item.So,please tell me how can i remove this Paste

1
@himanshu, thanks Himanshu . but,can u provide me the answerSushil Sharma

1 Answers

0
votes

you may subclass a UITextView or UITextField, and add these code below.

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    // Show your own menu item only
    return (action == @selector(showMyAlert:));
}