隐藏UiMenucontroller的复制选项

时间:2014-02-13 08:42:58

标签: ios cocoa-touch uiwebview

我想从UIMenuViewcontroller

中删除复制和定义选项

我在Google上查了一下,得到了我必须在我班级中覆盖以下方法并完成相同的操作

UIWebView

的子类中添加以下内容
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender{
 NSLog(@"action=========%@",NSStringFromSelector(action));
     if(action == @selector(copy:)
        return NO;

    }

但我没有得到蚂蚁选项命名副本:但得到所有其他像cut:,粘贴:,选择:等,但复制:选项不会来,所以我不能隐藏复制选项,直到我得到上面的复制选项方法

请告诉我我必须做什么,为什么复制选项不会出现

我正在采取行动,没有复制行动

2014-02-13  action=========cut:

2014-02-13  action=========select:

2014-02-13  action=========selectAll:

2014-02-13  action=========paste:

2014-02-13  action=========delete:

2014-02-13  action=========_promptForReplace:

2014-02-13  action=========_showTextStyleOptions:

2014-02-13  action=========_addShortcut:

2014-02-13  action=========_accessibilitySpeak:

2014-02-13  action=========_accessibilitySpeakLanguageSelection:

2014-02-13  action=========_accessibilityPauseSpeaking:

2014-02-13  action=========makeTextWritingDirectionRightToLeft:

2014-02-13  action=========makeTextWritingDirectionLeftToRight:

1 个答案:

答案 0 :(得分:-1)

向您的实施中添加致电[super canPerformAction:action withSender:sender]

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {  
    if (action == @selector(copy:))
    {
        return NO;
    }
    return [super canPerformAction:action withSender:sender];
}