开发者

IPhone, MPMoviePlayerController how to disable zooming when double tap on the screen?

开发者 https://www.devze.com 2022-12-13 10:03 出处:网络
How can I dissable the strange double tap behaviour when playing movie using MPMoviePlayerController.

How can I dissable the strange double tap behaviour when playing movie using MPMoviePlayerController.

The double tap make开发者_如何学Gos zoom/unzoom of the movie and makes some of my gestures in the overlay view to stop working on the double tap area.


I had the same problem. Just add:

self.moviePlayerViewController.view.userInteractionEnabled = NO;


Actually you can do something like, it works fine for me :) :

[[[self.moviePlayer view] subviews] enumerateObjectsUsingBlock:^(id view, NSUInteger idx, BOOL *stop) {
    [[view gestureRecognizers] enumerateObjectsUsingBlock:^(id tap, NSUInteger idx, BOOL *stop) {
        if([tap isKindOfClass:[UITapGestureRecognizer class]]) {

            if([tap numberOfTapsRequired]==2)
            {
                [view removeGestureRecognizer:tap];

            }
        }
    }];
}];


The .userInteraction bool will solve the problem, unless you have your own gesture recognizers doing work in the MPMoviePlayerViewController.

If that's the case, then do this instead;

self.player.view.gestureRecognizers = nil; 

Then afterwards, you can add & use your own gesture recognizers, since the interactivity of the player is still yes.

0

精彩评论

暂无评论...
验证码 换一张
取 消