A UIScrollView has it's own gesture recognizers, e.g. for panning. I'd like to override some functionality with regards to the panning of a UIScrollView. More specifically, I want a scrollview to stop recognizing multiple gestures if the y velocity of a pan gesture is lower as 0.25f.
In Objective-C the code would look like the following (MyScrollView is a subclass of UIScrollView and implements the UIGestureRecognizerDelegate protocol):
@implementation MyCellScrollView
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) {
CGFloat yVelocity = [(UIPanGestureRecognizer*)gestureRecognizer velocityInView:gestureRecognizer.view].y;
return fabs(yVelocity) <= 0.25;
}
return YES;
}
@end