如何在iOS中的MPMoviePlayerViewController中禁用FullScreen

Rav*_*avi 6 iphone objective-c mpmovieplayercontroller ios

我正在和MPMoviePlayerViewController,

MPMoviePlayerViewController *avPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
// [movieView prepareToPlay];

[avPlayer.view setFrame: CGRectMake(0, 200, 320, 100)];  // player's frame must match parent's
[avPlayer shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
[avPlayer shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft];
avPlayer.moviePlayer.scalingMode=MPMovieScalingModeAspectFit;
avPlayer.moviePlayer.useApplicationAudioSession=NO;
avPlayer.moviePlayer.controlStyle=MPMovieControlStyleEmbedded;
//avPlayer.moviePlayer.repeatMode=MPMovieRepeatModeOne;
avPlayer.moviePlayer.scalingMode=MPMovieScalingModeFill;
[self.view addSubview: avPlayer.view];
Run Code Online (Sandbox Code Playgroud)

这个功能工作正常.但我需要禁用全屏MPMoviePlayerViewController.所以,我写的

avPlayer.moviePlayer.fullscreen=NO;
Run Code Online (Sandbox Code Playgroud)

但这不起作用.

请你给我一个建议.

Dar*_*iya 0

使用此代码禁用MPMoviePlayerViewController.

moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleNone;
Run Code Online (Sandbox Code Playgroud)

或检查此输入您的视图控制器。

 [[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(Enter:) 
                                             name:MPMoviePlayerWillEnterFullscreenNotification 
                                           object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(Enter:) 
                                             name:MPMoviePlayerDidEnterFullscreenNotification 
                                           object:nil];
Run Code Online (Sandbox Code Playgroud)

我希望这段代码对你有用。