iphone - 关于来自 UITapGestureRecognizer 的消息

标签 iphone objective-c ios

以下内容来自文档:

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.

上面这段话似乎表明发送了不止一条消息。消息将包括“开始”消息和“结束”消息。但不知何故,我只是收到“手势结束”消息。有什么办法可以让我同时获得点击开始和结束消息吗? (我想跟踪的是 - “开始”:用户触摸屏幕的那一刻和“结束”:用户将手指从屏幕上移开的那一刻。)

希望有这方面知识的人能帮忙...

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITapGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/cl/UITapGestureRecognizer

最佳答案

UITapGestureRecognizer 仅在手势状态为 UIGestureRecognizerStateEnded 时触发

如果您想使用手势识别器来检测按下的开始和结束,请使用 UILongPressGestureRecognizer,并将 minumumPressDuration 设置为 0

关于iphone - 关于来自 UITapGestureRecognizer 的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7566812/

相关文章:

ios - 如何根据条件在核心数据中插入数据

iphone - UIKit中的类如何实现深拷贝?

iphone - 从rails下载到iphone压缩文件缺少部分

iphone - 使用 CATiledLayer 绘制文本

ios - Titanium MapView 不释放内存

ios - 如何使用 ios sdk 在没有权限对话框的情况下登录 facebook?

iphone - 链接器选项 'Link all assemblies"和 "Link SDK assemblies only"导致第 3 方静态库中出现 undefined symbol

iphone - 如何隐藏组 TableView 中自定义单元格的 UITableViewCell 边框?

ios - 解析 PFQueryTableViewControllerobjectsDidLoad 在 numberOfRowsInSection 之前未执行

ios - UITapGestureRecognizer 在 UITextView 中触发一次