gpt4 book ai didi

iphone - MPMovieViewController 不自动旋转

转载 作者:行者123 更新时间:2023-12-03 20:06:15 24 4
gpt4 key购买 nike

我有一个通过 MPMoviePlayerViewController 播放视频的应用程序,该应用程序在 UITableViewController 上执行选择操作后呈现,该 UITableViewController 嵌入在 UINavigationController 中,而 UINavigationController 又嵌入 UITabBarController 中。

TabBar Controller > 导航 Controller > TableView Controller * MPMoviePlayerViewController

在iOS5中一切正常,但是升级到iOS6我发现视频在呈现后没有按预期旋转。如果我在目标摘要页面上选择了更多受支持的界面方向,则会导致整个应用程序旋转。

Apple 文档在 UIViewController 类引用中说了以下内容:

In iOS 6, your app supports the interface orientations defined in your app’s Info.plist file. A view controller can override the supportedInterfaceOrientations method to limit the list of supported orientations. Generally, the system calls this method only on the root view controller of the window or a view controller presented to fill the entire screen; child view controllers use the portion of the window provided for them by their parent view controller and no longer participate in directly in decisions about what rotations are supported. The intersection of the app’s orientation mask and the view controller’s orientation mask is used to determine which orientations a view controller can be rotated into.

但我不确定 subview Controller 何时真正参与旋转决策。当电影播放时,我是否需要更改选项卡栏 Controller 对 shouldAutorotatesupportedInterfaceOrientations 的响应方式?

最佳答案

基本答案是,所有 View Controller 的旋转行为均由“最顶层” View Controller 确定,但 MPMoviePlayerViewController 确定其自己的旋转行为,因为它充当“呈现以填充整个屏幕的 View Controller ”。

例如:如果我有一个单 View 应用程序,则自动旋转方法将在单 View 的 View Controller 上处理。如果我将该 View 嵌入到选项卡栏中,那么选项卡栏 Controller 实现将处理这些消息。如果我将 View 嵌入到选项卡栏内的导航栏中,则选项卡栏实现仍然是处理消息的实现(如果其他 View Controller 嵌入其中,它仍然是“ Root View Controller ”)。

MPMoviePlayerViewController 将对shouldAutorotate 响应"is",并支持横向方向。仍然可以防止影片旋转(通过在目标摘要页面上不选择纵向方向),但您为 View Controller 层次结构选择的设置不会影响其执行此操作的能力。当 MPMoviePlayerViewController 出现时,它是处理自动旋转消息的 View Controller 。当它不存在时,由选项卡栏 Controller 负责。

关于iphone - MPMovieViewController 不自动旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12775025/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com