iOS 在 Modal View Controller 旋转时旋转 View Controller

标签 ios rotation modalviewcontroller

我有一个 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/

相关文章:

iphone - 强制 autoresizingMask 应用于 UIView

objective-c - 带有 ModalPresentationStyle 的 Popover 在 iOS 7 iPad 中不居中

ios - 横向模态模式在关闭时切换为纵向模式

iOS - 在关闭另一个 View Controller 后立即呈现 View Controller

javascript - 如何在 Ipad 中调试应用程序?

python - 使用 NumPy 进行快速张量旋转

swift - SceneKit euler 在旋转期间角度奇怪的值

ios - 真的很奇怪的应用程序颜色行为?

ios - UITableViewCell XCTest 中的测试单元格

ios - 如何在Parse中获取对象ID