我在基于UITextView的iPhone应用程序中工作。在我的一个屏幕中,当用户点击屏幕时,我有3个UITextView,显示带有自定义MenuItems的UIMenuController。 In this scenario UITextView is in Active means UITextView is becomResponder. So when i show UIMenuItem taping the screen UITextView UIMenuController showing with "Paste" option.
我想在用户触摸屏幕时禁用UITextView中的UIMenuController项。 Could you please anyone tell me how to disable UITextView with showing keypad and disable UIMenuController.?
先谢谢。
答案 0 :(得分:0)
你可以像这样编码:
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))
return NO;
return [super canPerformAction:action withSender:sender];
}
另外,你可以写:
- (BOOL)canBecomeFirstResponder {
return NO;
}
使文字字段不可编辑。希望它适合你。