문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top