I'm creating a space cocos2d game with objetive-c. I have in the bottom left 2 arrows to move the sprite left or right. I also implemented a swipe gesture to change weapon, however it only happens when I'm not touching the screen.

I would like the player to change weapons while he's moving the sprite and not have to lift the finger from the arrows and stop moving the sprite to change weapons.

Is there any way I can detect Gestures while having a finger pressed un a buton in thes screen?


If you want to rely just on UIGestureRecognizers you will have to use a UIPanGestureRecognizer, it will be able to recognize when the user is moving the finger without having to lift it. It does recognizes every movement done after starting holding the finger on the screen.

Of course you will have to cheat a little bit to manage both it and the movement but it will be feasible.

  • \$\begingroup\$ I finally decided to reduce the touch rectangle so it dosn't interdere with my control buttons. But anyway thanks. \$\endgroup\$ – marcg11 Apr 3 '12 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.