currently I want to let UITextView to have a double tap gesture. It seems UITableView has its own double tap gesture, when we double tapped, some text will be selected. So I want to remove this default double tap gesture to my own gesture recognizer. I tried many methods, and all failed. It seems there's no way to remove the default recognizer of UITextView. I also want to add a transparent view on this UITextView to do double tap event, but this subview will block other gestures on UITextView. Is there some method to add double tap gesture recognizer to UITextView? I really hope there will be a work around.
I am still expecting a work around of iOS5 :)
There are a number of other gesture recognizers attached to a text view. Since you don't seem to need them. You can remove them.
myTextView.gestureRecognizers = nil;
before adding your double tap recognizer. It works.
then you can add
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(mySelector)];
tapRecognizer.numberOfTapsRequired = 2;
tapRecognizer.numberOfTouchesRequired = 1;
[myTextView addGestureRecognizer:tapRecognizer];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With