Is there anyway to distinguish pan and swipe gesture in the same view? I have 2 gestures work on a same view simultaneously by using the delegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
I did set the pan gesture's property minimumNumberOfTouches = 1. The problem is when I'm panning, the swipe gesture is triggered. How to make swipe gesture stop when I'm in panning process?
Try to call the requireGestureRecognizerToFail: method in your swipe gesture
[swipeGestureRecognizer requireGestureRecognizerToFail:panGestureRecognizer];
This should cause the pan gesture to cancel the swipe gesture if the pan gesture is recognized or began.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With