以下内容来自文档:
Although taps are discrete gestures, they are discrete for each state of the gesture recognizer; thus the associated action message is sent when the gesture begins and is sent for each intermediate state until (and including) the ending state of the gesture.
上面这段话似乎表明发送了不止一条消息。消息将包括“开始”消息和“结束”消息。但不知何故,我只是收到“手势结束”消息。有什么办法可以让我同时获得点击开始和结束消息吗? (我想跟踪的是 - “开始”:用户触摸屏幕的那一刻和“结束”:用户将手指从屏幕上移开的那一刻。)
希望有这方面知识的人能帮忙...
最佳答案
UITapGestureRecognizer
仅在手势状态为 UIGestureRecognizerStateEnded
时触发
如果您想使用手势识别器来检测按下的开始和结束,请使用 UILongPressGestureRecognizer
,并将 minumumPressDuration
设置为 0
关于iphone - 关于来自 UITapGestureRecognizer 的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7566812/