I've a scenario where I am using a list of views that scrolls horizontally, like pagination. And each view has tableviews which scrolls vertically. Now the issue is when I want to scroll vertically. It hardly allows me to do that. But vertically it's fine. Can I arrange this in a way that vertically scrolling should have higher priority than horizontal? But both should be accessible.
2 Answers
1
votes
2
votes
In iOS 5, UIScrollView
exposes its UIPanGestureRecognizer
.
Set your custom swipe’s delegate to self and make the gestureRecognizer
a property or ivar, and make your class conform to the <UIGestureRecognizerDelegate>
protocol.
Then, implement UIGestureRecognizerDelegate
’s – gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer
: like so:
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
if ([gestureRecognizer isEqual:self.swipe] && [otherGestureRecognizer isEqual:self.scrollView.panGestureRecognizer])
{
return NO;
}
return YES; //default
}