hzxu
hzxu

Reputation: 5823

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!

Upvotes: 3

Views: 4192

Answers (1)

user244343
user244343

Reputation:

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.

Upvotes: 7

Related Questions