iOS TapGestureRecognizer 在 numberOfTapsRequired=1 时吃掉双击
我有一个 MPMoviePlayerViewController ,我在它上面放了一个 UIView 来识别单击,然后我可以显示视频的控制面板,双击应该放大/缩小视频播放,所以我为手势识别器设置 numberOfTapsRequired=1 ,但是当我双击时,视频不会缩放,但会显示控制面板,然后消失,就像两次单击一样。
有办法解决吗?
谢谢!
I have a MPMoviePlayerViewController and I put a UIView on top of it to recognise single tap then I can show a control panel for the video, and double tap should zoom in/out the video play, so I set numberOfTapsRequired=1 for the gesture recogniser, but when I do a double-tap, the video is not zoom but the control panel is displayed and then disappeared as if there were two single taps.
is there anyway to solve it?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。 <代码>[UIGestureRecognizer requireGestureRecognierToFail:] 正是为了这个目的。将单击手势识别器设置为要求双击手势识别器失败。如果没有失败,则会进行缩放。如果确实失败(即您只点击了一次而不是两次),那么您的控制面板将显示。
Yes.
[UIGestureRecognizer requireGestureRecognierToFail:]
is for exactly this purpose. Set your single tap gesture recognizer to require the double-tap gesture recognizer to fail. If it doesn't fail, then the zoom happens. If it does fail (i.e. you have only tapped once instead of twice) then your control panel will show.