【问题标题】:MPMoviePlayerController only rotate on fullscreenMPMoviePlayerController 仅全屏旋转
【发布时间】:2012-01-15 07:16:59
【问题描述】:

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

问题是我想在视频全屏时允许旋转,但在退出时不允许旋转。我的基础表不支持横向。有没有办法只在全屏时支持旋转?我认为这将是 MPMoviePlayerController 的标准组件。

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

【问题讨论】:

    标签: iphone objective-c rotation mpmovieplayercontroller fullscreen


    【解决方案1】:

    您是否尝试过继承 MPMoviePlayerController MPMoviePlayerViewController 类并覆盖该方法:

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

    【讨论】:

    • 我还没有尝试过,但也许我现在可以试一试。如果这不起作用,我将尝试使用 MPMoviePlayerViewController。
    • MPMoviePlayerController 不是 UIViewController - 尝试时这真的对你有用吗?
    • @直到你是对的,我的错。我指的是 MPMoviePlayerViewController。答案已更新。
    • 感谢您的回复。我最终使用 MPMoviePlayerVIEWController 来呈现模态视图,现在它自己处理旋转。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-15
    • 2014-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多