gpt4 book ai didi

iphone - 如何在 iOS 的 MPMoviePlayerViewController 中禁用全屏

转载 作者:可可西里 更新时间:2023-11-01 04:04:18 25 4
gpt4 key购买 nike

我正在使用 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];

此功能运行良好。但是我需要为 MPMoviePlayerViewController 禁用全屏。所以,我写的

avPlayer.moviePlayer.fullscreen=NO;

但这行不通。

请你给我建议好吗

最佳答案

使用此代码在 MPMoviePlayerViewController 中禁用全屏。

moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleNone;

或选中此项以输入您的 View Controller 。

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

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

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

关于iphone - 如何在 iOS 的 MPMoviePlayerViewController 中禁用全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18052199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com