How do I measure the velocity of a swipe?

前端 未结 4 1763
北荒
北荒 2021-02-11 03:21

I\'m developing a game that will use the force of the swipe as a variable user input.

I read from the documentation that on the touchesEnded event, I can get the allTouc

4条回答
  •  悲&欢浪女
    2021-02-11 03:43

    You could use a UIPanGestureRecognizer which has function velocityInView. See https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPanGestureRecognizer_Class/

提交回复
热议问题