I want to disable text selection on a UITextView. Until now what i\'ve already done is:
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
textView.editable = NO;
or
[textView setEnabled:NO];
im not sure what u meant
If you want to prevent the text selection but keep links interactions, add the following textview delegate methods
- (void)textViewDidChangeSelection:(UITextView *)textView
{
[textView setSelectedRange:NSMakeRange(NSNotFound, 0)];
}
If you want to disable cut/copy/paste on all UITextView
of your application you can use a category with :
@implementation UITextView (DisableCopyPaste)
- (BOOL)canBecomeFirstResponder
{
return NO;
}
@end
It saves a subclassing... :-)
Otherwise, just subclass UITextView
and put :
- (BOOL)canBecomeFirstResponder
{
return NO;
}