UITapGestureRecognizer 与 UIPinchGestureRecognizer 交互
我有一个视图控制器,它将 UITapGestureRecognizer
附加到其主 UIView
,并允许用户点击屏幕以使状态、导航和工具栏重新出现/消失(就像照片应用程序一样)。我还有一个附加到主 UIView
的 UIScrollView
,它实现了缩放,因此有自己的 UIPinchGestureRecognizer
和 UIPanGestureRecognizer
实现滚动和缩放。
我遇到的问题是,当要缩放/滚动 UIScrollView
时,它对拾取附加到主 UIView
UITapGestureRecognizer
非常敏感/代码>。似乎很多时候 UITapGestureRecognizer
都会在不应该触发的时候被触发。有人知道如何修复低于 5.0 的 ios 版本吗?有什么办法可以覆盖 UIScrollView
中 UIGestureRecognizerDelegate
的同步手势委托方法,并防止 UITapGestureRecognizer
在其他手势期间触发?
I have a view controller that attaches a UITapGestureRecognizer
to its main UIView
, and enables the user to tap the screen to make the status, navigation, and tool bars reappear / disappear (like the photos app). I also have a UIScrollView
attached to the main UIView
which implements zooming and thus has its own UIPinchGestureRecognizer
and UIPanGestureRecognizer
to implement scrolling and zooming.
The problem I'm having, is when going to zoom / scroll the UIScrollView
, it's very sensitive to picking up the UITapGestureRecognizer
which is attached to the main UIView
. It seems a lot of the time the UITapGestureRecognizer
gets triggered when it shouldn't. Anyone have any ideas on how to fix this for versions of ios below 5.0? Is there someway I can override the simultaneous gestures delegate method for the UIGestureRecognizerDelegate
in the UIScrollView
and prevent the UITapGestureRecognizer
from firing during other gestures?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 requireGestureRecognizerToFail: 方法。
此调用告诉点击识别器等待捏合识别器失败。
Use the
requireGestureRecognizerToFail:
method.This call tells the tap recognizer to wait for the pinch recognizer to fail.