禁用UITextField的copy,paste,copy的menu

只需覆盖canPerformAction:withSender方法就可以,canPerformAction:withSender属于UIResponder类的。

如下:
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender {

UIMenuController *menuController = [UIMenuController sharedMenuController];

if (menuController) {

[UIMenuController sharedMenuController].menuVisible = NO;

}

return NO;

}


你可能感兴趣的:(禁用UITextField的copy,paste,copy的menu)