I have a UITextView that takes up the entire screen (so it's the hit-test view I guess). When I don't want the user to edit the text view, I set its editable property to NO. This still allows the user to scroll the text view (I want scrolling!).
textView.editable = NO;
When the text view is un-editable, I add a tap gesture recognizer to a parent view to detect double taps.
However, the parent view never seems to receive a double tap gesture. It seems like the text view and/or its 9 gesture recognizers is gobbling up all the touch events even when it's un-editable (I logged the names of a text view's 9 gesture recognizers: my favorite is UITapAndAHalfRecognizer).
So I have iterated through the text view's 9 gesture recognizers and regulated the delivery of touches so that the parent view could receive touches:
Unfortunately, the parent view still doesn't receive double taps. Any suggestions? Keep in mind that I want my text view to scroll. Therefore, I don't want to set the text view's userInteractionEnabled property to NO.
textView.editable = NO;
When the text view is un-editable, I add a tap gesture recognizer to a parent view to detect double taps.
Code:
self.doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(recognizedDoubleTap:)];
self.doubleTapRecognizer.numberOfTapsRequired = 2;
[self.view addGestureRecognizer:self.doubleTapRecognizer];
However, the parent view never seems to receive a double tap gesture. It seems like the text view and/or its 9 gesture recognizers is gobbling up all the touch events even when it's un-editable (I logged the names of a text view's 9 gesture recognizers: my favorite is UITapAndAHalfRecognizer).
So I have iterated through the text view's 9 gesture recognizers and regulated the delivery of touches so that the parent view could receive touches:
Code:
NSArray *gestures = [textView gestureRecognizers];
for (int i = 0; i < 9; i++) {
[[gestures objectAtIndex:i] setCancelsTouchesInView:NO];
[[gestures objectAtIndex:i] setDelaysTouchesEnded:NO];
}
Unfortunately, the parent view still doesn't receive double taps. Any suggestions? Keep in mind that I want my text view to scroll. Therefore, I don't want to set the text view's userInteractionEnabled property to NO.
Last edited: