I have a UIScrollView with UIViews inside it. The UIScrollView has two-finger scroll enabled. The UIViews each have a panGestureRecognizer. I want the following functionality:
If two-touch pan --> scroll.
If single touch pan && touch on a UIView --> fire UIView's panGestureRecognizer.
I want to do this by overwriting UIScrollView's hitTest. If the number of touches is greater than 1, return the UIScrollView to possibly scroll. If the number of touches is 1, return the normal hitTest result to possibly fire UIView's panGestureRecognizer. But my UIScrollView's hitTest code never has any touches! (Although I successfully two-finger scroll, the hitTest doesn't have any touches.)
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
NSSet *touches = [event touchesForView:self];
NSLog(@"%@", touches);
if ([touches count] > 1)
{
return self;
}
UIView *usualView = [super hitTest:point withEvent:event];
return usualView;
}