Detect when UIGestureRecognizer is up, down, left and right Cocos2d

Apparently each UISwipeGestureRecognizer can only detect the swipe in the given direction. Even though the direction flags could be OR’ed together the UISwipeGestureRecognizer ignores the additional flags.

The solution is to add one UISwipeGestureRecognizer for each direction you want the swipe gesture to be recognized, and set each recognizer’s direction accordingly to either up, down, left and right. If you want to test for a swipe in any direction you’ll have to add four UISwipeGestureRecognizers.

It’s kind of odd but that’s the only way it worked for me.

Leave a Comment