简体   繁体   中英

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.

is there anyway to solve it?

Thanks!

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 (ie you have only tapped once instead of twice) then your control panel will show.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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