Just tried this out myself and it seems as if the UILongPressGestureRecognizer
will transition to its end state as soon as the UISwipeGestureRecognizer
begins. Just make sure shouldRecognizeSimultaneouslyWithGestureRecognizer:
returns YES for this gesture combination.
ios UIGestureRecognizer for longpress, then swipe
-
19-07-2023 - |
Domanda
I'm using a UIGestureRecognizer to recognize a single tap, a double tap and a longpress.
What I would like to do is also recognize a longpress, then swipe to either left or right.
Would this be possible given that I'm already consuming a longpress? I'm confused on this one and would appreciate pointers on how to do.
Thanks
Soluzione
Altri suggerimenti
You'd need to use two gesture recognisers and make sure you track the state of the long press one when you receive a callback to say it's ended, and then do something based on the swipe/pan gesture following it.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow