【问题标题】:How can I start a movie in full screen mode OR re-adjust the player width when I go landscape?如何在全屏模式下开始电影或在横向播放时重新调整播放器宽度?
【发布时间】:2011-05-03 20:51:21
【问题描述】:

我有一个非常简单的移动视图,加载后会直接跳转到视频中。电影控件显示得很好,一切都很好。但是当我旋转到横向时,我遇到了一个问题,电影播放器​​的宽度不会随视图调整,所以它仍然太窄。

如果我处于全屏模式,我的导航栏消失了,我可以旋转,它工作没问题。

那么当我切换到横向时如何调整查看器的宽度,或者只是以全屏模式启动视图?

注意:[mpPlay setFullscreen:YES];不是为我做的。

这是我的其余代码:

- (void)viewDidLoad 
{
NSBundle * bundle = [NSBundle mainBundle];
NSString * moviePath = [bundle pathForResource:@"movie" ofType:@"mp4"];
NSURL * movieURL = [[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerController * mpPlay = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

[mpPlay.view setFrame: self.view.bounds];  // player's frame must match parent's
[self.view addSubview: mpPlay.view];

[mpPlay play];

 }

【问题讨论】:

    标签: iphone orientation mpmovieplayercontroller fullscreen landscape


    【解决方案1】:

    在您的视图控制器中覆盖 didRotateFromInterfaceOrientation: 并将电影播放器​​更改为新的宽度和高度。

    【讨论】:

    • 非常感谢!不敢相信我不知道这种方法
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-24
    • 1970-01-01
    • 1970-01-01
    • 2014-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多