Sunday, November 21, 2010

How to Disable Copy, Paste and Select for UITextView

Need to use UITextView, but don't want Copy, Paste and Select feature. How to disable that? Tried overwriting canPerformAction:withSender but I got still a flash of quickly disappearing popup menu and selection.

Subclass UITextView and overwrite canBeforeFirstResponder to return always NO:
@interface MyUITextView : UITextView
@end
@implementation MyUITextView
- (BOOL)canBecomeFirstResponder
{
   return NO;
}
@end
Now you have completely hidden and disabled copy, paste and select for UITextView!

No comments:

Post a Comment