问题描述
我听说可用于区分慢速滑动和快速轻弹。但我找不到任何API来区分它们。
I heard that UISwipeGestureRecognizer can be used to distinguish between a slow swipe and a fast flick. But I can't find any API to tell the difference.
推荐答案
你是否特别需要使用 UISwipeGestureRecognizer
,还是可以使用 UIPanGestureRecognizer
代替? UIPanGestureRecognizer
为您提供精确的移动数据,而 UISwipeGestureRecognizer
更基本,只检测是否发生了滑动(以及方向)。
Do you specifically need to use UISwipeGestureRecognizer
, or can you use UIPanGestureRecognizer
instead? UIPanGestureRecognizer
gives you precise movement data whereas UISwipeGestureRecognizer
is more basic and just detects whether or not a swipe happened (and in which direction).
有一个 -velocityInView:
方法,它返回一个CGPoint,表示每秒垂直和水平点数。
UIPanGestureRecognizer has a -velocityInView:
method which returns a CGPoint, expressing points per second, vertically and horizontally.
这篇关于如何使用UISwipeGestureRecognizer检测轻弹手势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!