Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextView disabling text selection

I'm having a hard time getting the UITextView to disable the selecting of the text.

I've tried:

canCancelContentTouches = YES; 

I've tried subclassing and overwriting:

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender    

(But that gets called only After the selection)

- (BOOL)touchesShouldCancelInContentView:(UIView *)view;   

(I don't see that getting fired at all)

- (BOOL)touchesShouldBegin:(NSSet *)touches                  withEvent:(UIEvent *)event              inContentView:(UIView *)view;  

(I don't see that getting fired either)

What am I missing?

like image 483
dizy Avatar asked Oct 28 '09 19:10

dizy


1 Answers

Issue How disable Copy, Cut, Select, Select All in UITextView has a workable solution to this that I've just implemented and verified:

Subclass UITextView and overwrite canBecomeFirstResponder:

- (BOOL)canBecomeFirstResponder {     return NO; } 

Note that this disables links and other tappable text content.

like image 114
Dafydd Williams Avatar answered Oct 15 '22 14:10

Dafydd Williams