Another approach is to override the UIScrollView method:
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event .
Returning YES will allow the user to scroll. NO refund.
NOTE. . This will disable all touches on any views embedded inside the UIScrollView that pointInside returns NO to. Useful if the area you do not want to scroll has no interaction.
This example allows UIScrollView to scroll through a UIScrollView when a user scrolls through a UITableView . (A UITableView and two UIViews nested inside a UIScrollView )
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { for (UIView *subview in self.subviews) { if ([subview pointInside:[self convertPoint:point toView:subview] withEvent:event] && ![subview isKindOfClass:[UITableView class]]) { return NO; } } return YES; }
Johann Burgess
source share