如何在纵向应用程序中在iOS4上播放全屏风景电影?

时间:2010-07-03 10:47:44

标签: iphone mpmovieplayercontroller ios4 landscape

问题如下:

我有一个应用程序,其中所有的viewcontrollers都只是纵向9ppical tabbar /导航应用程序),但我想在全屏横向模式下进行移动。这在iOS4中似乎是不可能的......

我能想到的最好的方法是将mpmoviecontroller视图添加到我的父视图并手动旋转,但是有两个问题,第一个是我没有“完成”按钮,而且用户仍然有可能按下“全屏”按钮,使视图成为肖像,完全错误。

使用[moviePlayer setFullscreen:YES animated:YES]时;方法它会自动设置纵向视图,无法旋转它。

有什么建议吗?

2 个答案:

答案 0 :(得分:1)

我不记得我在哪里发现了这个,但你可以将MPMoviePlayerViewController子类化,因此它只支持横向:

@interface CustomMPMovie : MPMoviePlayerViewController
@end

@implementation CustomMPMovie
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
     return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

@end

希望有所帮助......

答案 1 :(得分:0)

对于全屏播放,使用MPMoviePlayerViewController,然后以横向格式启动和播放,使用MPMoviePlayerViewController类上的“shouldAutorotateToInterfaceOrientation”方法。

看起来像这样:

[yourInstanceOfMPMoviePlayerViewController shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight];
相关问题