I have a UIScrollView
that fills the screen on one page of my app, but I want to allow the user to pan from the edge of the screen to reveal a view behind it. The problem is that the UIScrollView steals the touches from my UIScreenEdgePanGestureRecognizer
at the edge of the screen. Unfortunately, I can't access the UIScreenEdgePanGestureRecognizer
from the view controller that has the UIScrollView
(and vice-versa), so I am not able to use the method requireGestureRecognizerToFail:
because I cannot able to specify which gesture recognizer should be allowed to fail. The view controller with the scroll view is a child view controller of a container view controller that has the screen edge pan gesture recognizer attached to one of the container view controller's own views.
I'm also unable to use the delegate method
-(BOOL)gestureRecognizer:shouldRequireFailureOfGestureRecognizer:
because the UIScrollView
won't allow me to set my view controller as the delegate of the scroll view's UIPanGestureRecognizer
.
How can I prevent the scrollview from stealing the edge pan touches from my own gesture recognizer?
-(BOOL)gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:
and calling[otherGestureRecognizer requireGestureRecognizerToFail:gestureRecognizer];
before returning YES. Not sure if this is good practice, but it works. I did not find that returning NO from both of those methods changed the behavior though. You may want to check that that is actually happening. – Immaterialize