我有一个 UIViewController A,它在 UIButton 操作上打开另一个模态 UIViewController B。
我的问题是:当当前模式 UIViewController B 打开并旋转时 - 之前的 UIViewController A 根本不旋转。这意味着当我关闭 UIViewController B - UIViewController A 仍然处于旧状态(仍然是旧的界面方向)。目前我通过在 B 旋转时调用 A 中的方法来强制 A 旋转。
是否有另一种通用的方式来通知其他 View Controller 有关旋转的信息?或者什么是正确的方法?
最佳答案
如果您使用的是 iOS 6,那么您有 (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
。然后,您只需返回父 View 的设备方向。
编辑:如果您使用的是 iOS 5,您还可以检查 this .
关于iOS 在 Modal View Controller 旋转时旋转 View Controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13987528/