I have a bunch of UIButton
s within a UIView
within a UIScrollView
. I\'m trying to add a tap recognizer to the scroll view. The tap rec
You could also use the gestureRecognizer:shouldReceiveTouch:
method of the UIGestureRecognizerDelegate
, which is documented here, to accomplish the same thing. It offers a little more flexibility, for instance, if you want to cancel certain touches, but not others. Here's an example,
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view.superview isKindOfClass:[UIButton class]]) return NO;
return YES;
}