Sayed
Sayed

Reputation: 1062

Enable user interaction by double tap gesture

I disabled user interaction for a textview from the interface, and I want to enable it when double tapping on the textview, I tried this by using UITapGestureRecognizer but it seems to not be working when user interaction is disabled ?!

Any help ?

Upvotes: 0

Views: 162

Answers (1)

peko
peko

Reputation: 11335

Your textview will not regognize any user interaction even gestures if you disable them. you can put a label as overlay over the textview and add there the gesturerecognizer.

this overlay should be added when you like to disable user interaction on the textview

UILabel *overlay = [[UILabel alloc] initWithFrame:textview.frame];
overlay.backgroundColor = [UIColor clearColor];

if you add the overlay you don't even need to disable userinteractions on the textview because the overlay will not pass any user interaction to the textview. to interact with the textview again just remove the overlay. (best way to do this, is make it a property and the do something like [self.overlay removeFromSuperView]).

Upvotes: 1

Related Questions