MPMoviePlayerController 仅在全屏上旋转

发布于 2024-12-19 23:25:46 字数 246 浏览 7 评论 0原文

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

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

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

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.

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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷鸟归林 2024-12-26 23:25:46

您是否尝试过对 MPMoviePlayerController MPMoviePlayerViewController 类进行子类化,并重写该方法:

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

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

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if (!self.fullscreen) {
        return UIDeviceOrientationIsPortrait(interfaceOrientation);
    }
    return YES;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文