swipe and pan gesture overlap

gestures, ios

Solution

Check out the `UIGestureRecognizerDelegate` protocol here:

https://developer.apple.com/library/ios/documentation/uikit/reference/UIGestureRecognizerDelegate_Protocol/Reference/Reference.html

Specifically, the

`gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:`

method might be useful. If you simply return `YES` from this method, both gestures can be recognized at the same time, so you can respond properly to both.

Problem

is it possible to let a specific gesture fail so the next possible gesture is recognized? to be more specific, look at the sample snippet: ``` UISwipeGestureRecognizer *swipeLeft = [initialize UISwipeGestureRecognizer... @selector(handleSwipe:)] swipeLeft = UISwipeGestureRecognizerDirectionLeft; swipeLeft.delegate = self; UIPanGestureRecognizer *pan = [initialize UIPanGestureRecognizer... @selector(handlePan:)] pan.delegate = self; [pan requireGestureRecognizerToFail:swipeLeft]; ``` the above code states that if swipe left is not recognized by the device, pan gesture handler will be used. so my question: is it possible to let swipeLeft intentionally fail (after being recognized as swipe left touch by the device) based on some criteria that is checked on handleSwipe, and let the pan gesture handle the touch input instead? thanks.

Original source