MPMoviePlayerController仅在全屏模式下旋转 [英] MPMoviePlayerController only rotate on fullscreen

查看:42
本文介绍了MPMoviePlayerController仅在全屏模式下旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格视图,其中包含一个MPMoviePlayerController实例作为表格标题,并且当用户按下我的自定义叠加按钮时,视频会扩展到全屏.视频的纵横比非常小,因此在纵向模式下,我想大多数用户都会旋转到横向.

I have a table view that contains an instance of MPMoviePlayerController as the table header and when the user presses my custom overlay button, the video expands to full screen. The aspect ratio of the video is such that in portrait mode it is very small, and I imagine most users will rotate to landscape.

问题是我想在视频全屏显示时允许旋转,而在退出视频时不允许旋转.我的基础表不支持横向.只有全屏时才有支持旋转的方法吗?我以为这将是MPMoviePlayerController的标准组件.

The problem is that I want to allow rotation when the video is full screen but not when it exits. My underlying table does not support landscape. Is there a way to support rotation only when full screen? I thought this would be a standard component of MPMoviePlayerController.

我使用的是SDK 5.0,但它最初是使用4.3构建的.

I'm using SDK 5.0, but it was originally built with 4.3.

推荐答案

您是否尝试对 MPMoviePlayerController MPMoviePlayerViewController类进行子类化并覆盖该方法:

Have you tried subclassing the MPMoviePlayerController MPMoviePlayerViewController class, and overriding the method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if (!self.fullscreen) {
        return UIDeviceOrientationIsPortrait(interfaceOrientation);
    }
    return YES;
}

这篇关于MPMoviePlayerController仅在全屏模式下旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆