Reputation: 38142
How do we disable Cut-Copy-Paste or Select-SelectAll menu when tapped on a UITextField. I tried with below code but it did not work.
if ([UIMenuController sharedMenuController]) {
[UIMenuController sharedMenuController].menuVisible = NO;
}
Upvotes: 0
Views: 2789
Reputation: 6160
Make a subclass if UITextView and implement this function
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if (action == @selector(paste:) || action == @selector(copy:))//and put other actions also
return NO;
return [super canPerformAction:action withSender:sender];
}
Upvotes: 2
Reputation: 12333
canBecomeFirstResponderhere
should do the trick. make sure you delegate your UITextField
- (BOOL)canBecomeFirstResponder {
return NO;
}
Upvotes: -2