0

问题如下:

我有一个应用程序,其中所有视图控制器都是纵向的,只有 9 个典型的选项卡栏/导航应用程序),但我想在全屏横向模式下进行移动。这在 iOS4 中似乎是不可能的......

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

当使用 [moviePlayer setFullscreen:YES animated:YES]; 方法它会自动将视图设置为纵向并且无法旋转它。

有什么建议么?

4

2 回答 2

1

我不记得我在哪里找到的,但是您可以将 MPMoviePlayerViewController 子类化,因此它只支持横向:

@interface CustomMPMovie : MPMoviePlayerViewController
@end

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

@end

希望能帮助到你..

于 2010-07-07T19:52:34.307 回答
0

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

它看起来像这样:

[yourInstanceOfMPMoviePlayerViewController shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight];
于 2011-12-27T03:58:46.347 回答