开发者

How do I detect a swiping / flicking gesture?

I want to allow the user to flick a ball that is on screen. The user would tap on the ball and then flick, the velocity / speed of the flick would then dictate initial velocity.

I took a look at UISwipeGestureRecognizer but it seems like that is more target开发者_开发问答ed at navigation than flicking.

How do I go about implementing this?

I am using Cocos2d and Box2d.


Have you considered UIPanGestureRecognizer? You can get velocity data from that ([panGesture velocityInView:]), and distinguish the initial velocity of the 'swipe' using the state property on the gesture recognizer.

Or is that not sufficient?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜