首页 文章

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

提问于
浏览
0

问题如下:

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

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

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

有什么建议?

2 回答

  • 0

    我不记得我在哪里发现了这个,但你可以继承MPMoviePlayerViewController,因此它只支持横向方向:

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

    希望能帮助到你..

  • 1

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

    它看起来像这样:

    [yourInstanceOfMPMoviePlayerViewController shouldAutorotateToInterfaceOrientation: UIInterfaceOrientationLandscapeRight];
    

相关问题