I am writing a card game. When users touch a card in their hand, the card they are touching slides out a little to clarify which one they are touching since they can have up to 18 cards in their hand and they are kind of small. What I want next is for the user to be able to swipe the card up to play it.
I have tried to use the UISwipeGestureRecognizer
, but since the user may pause when they first touch the screen (to make sure the right card slides out), it often doesn't recognize it as a swipe. The user may also just slide his finger over to the adjacent card and then swipe. So, that's another issue since gestures are only recognized on the UIView that the touch begins on.
The best I can think of is to use a UIPanGestureRecognizer
on the parent view (the UIView that contains all the cards). I can use it's velocity to decide whether or not it should be considered a swipe. I'd have to set cancelsTouchesInView
to NO
and still just use touchesBegan
, etc. to detect which card was swiped. Is there a better way?