代码之家  ›  专栏  ›  技术社区  ›  Raptor

如何防止mpmovieplayervewcontroller中的捏手势?

  •  1
  • Raptor  · 技术社区  · 14 年前

    作为 MPMoviePlayerViewController

    我试着超越 touchesBegan WillEnterFullScreenNotification & DidEnterFullScreenNotfication ,但没用。

    3 回复  |  直到 10 年前
        1
  •  2
  •   curthipster    14 年前

    MPMoviePlayerController 对象和设置 userInteractionEnabled NO .

    moviePlayer = [[MPMoviePlayerController alloc] init];
    [moviePlayer view].userInteractionEnabled = NO;
    

    这可防止任何用户触摸通过并更改屏幕的方向或全屏状态 MPMoviePlayer控制器

        2
  •  1
  •   RMeijs    12 年前

    在我的情况下,jontron/curhipster接受的答案不起作用。

    controlStyle MPMovieScalingModeFill 讨厌的掐被忽略了。

    NSString *filepath   =   [[NSBundle mainBundle] pathForResource:@"tutorial" ofType:@"mov"];
    NSURL    *fileURL    =   [NSURL fileURLWithPath:filepath];
    self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
    
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlaybackComplete:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:self.moviePlayerController];
    
    [self.view addSubview:self.moviePlayerController.view];
    self.moviePlayerController.fullscreen = YES;
    self.moviePlayerController.scalingMode = MPMovieScalingModeFill;
    self.moviePlayerController.controlStyle = MPMovieControlStyleFullscreen;
    [self.moviePlayerController play];
    
        3
  •  1
  •   Pion    11 年前

    [[[self.moviePlayer view] subviews] enumerateObjectsUsingBlock:^(id view, NSUInteger idx, BOOL *stop) {
               [[view gestureRecognizers] enumerateObjectsUsingBlock:^(id pinch, NSUInteger idx, BOOL *stop) {
                    if([pinch isKindOfClass:[UIPinchGestureRecognizer class]]) {
                        [view removeGestureRecognizer:pinch];
                    }
               }];
          }];