Question

What I would like to do is to detect a swipe gesture followed by a pan gesture as part of the same touch sequence. So the user first swipes an object to carry out an action, then, while keeping their finger on the screen, moves up/down to propagate the action to surrounding objects.

I have a swipe gesture recognizer and a pan gesture recognizer.

It seems to me that the ideal way to make them behave the way I want is to do this:

[myPanGestureRecognizer requireGestureRecognizerToSucceed:mySwipeGestureRecognizer];

But although I was sure that I hadn't just imagined requireGestureRecognizerToSucceed:, it seems I have.

Is there a way to achieve what I want without subclassing UIGestureRecognizer?

Was it helpful?

Solution

You can do this by setting both the swipe and the pan to recognize simultaneously, and subclassing the pan so that it does actually mark itself as recognized until the swipe has been recognized.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top