问题
Am working in UITextView based iPhone app. In one of my screen i having 3 UITextView when the user tap on the screen am showing UIMenuController with custom MenuItems. 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.
I want to disable UIMenuController item from UITextView when the user touches the screen. Could you please anyone tell me how to disable UITextView with showing keypad and disable UIMenuController.?
Thanks in advance.
回答1:
You can Code like this:
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if (action == @selector(paste:))
return NO;
return [super canPerformAction:action withSender:sender];
}
other wise you can write:
- (BOOL)canBecomeFirstResponder {
return NO;
}
To make your textfiled noneditable. Hope it works for you.
来源:https://stackoverflow.com/questions/12990043/how-to-disable-copy-paste-options-in-uitextview-and-enable-it-again-iphone-app