如何判断子视图是否被点击两次
我有一个在 UIView 内部分配的 UIImageView。我想使用 TOUCCHESENDED 或 TOUCCHESBEGAN 双击该子视图并发送回调或至少发送日志。我将不胜感激任何可以上传一些代码的人。
I have a UIImageView that I allocated inside of a UIView. I want to double tap that subview using the TOUCHESENDED or TOUCHESBEGAN and send a callback or at least a log. I would appreciate anyone who can upload some code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是如何在 touchesBegan 中使用 .tapCount 属性:
Here's how to use the .tapCount property inside touchesBegan:
根据文档,不建议子类化
UIImageView
,但这是为了绘图,如果您只想捕获事件,您可以子类化UIImageVIew
并捕获事件。然后查看触摸的tapCount
属性。根据 http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UITouch_Class/Reference/Reference.html#//apple_ref/occ/instp/UITouch/tapCountAs per the documentation, it is not recommended to subclass
UIImageView
, but this is for drawing, if you only want to catch events, you may subclassUIImageVIew
and catch the event. Then look at thetapCount
property of the touch. As per http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UITouch_Class/Reference/Reference.html#//apple_ref/occ/instp/UITouch/tapCount