简体   繁体   English

iOS TapGestureRecognizer会对numberOfTapsRequired = 1进行双击

[英]iOS TapGestureRecognizer eats double tap for 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. 我有一个MPMoviePlayerViewController,我在它上面放了一个UIView来识别单击,然后我可以显示视频的控制面板,双击可以放大/缩小视频播放,所以我为手势识别器设置numberOfTapsRequired = 1 ,但是当我进行双击时,视频不会缩放,但控制面板会显示然后消失,好像有两个单击。

is there anyway to solve it? 无论如何要解决它吗?

Thanks! 谢谢!

Yes. 是。 [UIGestureRecognizer requireGestureRecognierToFail:] is for exactly this purpose. [UIGestureRecognizer requireGestureRecognierToFail:]就是出于这个目的。 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 (ie you have only tapped once instead of twice) then your control panel will show. 如果它确实失败了(即你只点击了一次而不是两次),那么你的控制面板就会显示出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM