我的应用程序具有子类化shouldautorotateToInterfaceOrientation的 View Controller 。在其中,我决定每个 View 的旋转。这工作正常。但在iOS6中,虽然看了Apple提供的文档,但看不懂。
我的应用程序将导航 Controller 作为 Root View Controller 。该导航 Controller 有选项卡 Controller 。选项卡 Controller 有一些 View Controller 。我希望第一个 View Controller (在选项卡 Controller 中)仅以纵向模式查看,第二个 View Controller (在选项卡 Controller 中)同时以纵向和横向模式查看。在iOS5下可以正常运行。 但我不知道如何在iOS6中实现。虽然我知道我应该子类 supportedInterfaceOrientations,但当旋转发生时它不起作用。令我惊讶的是,当 View 显示时它就会被调用。 如何做出我想要的东西?
感谢您的阅读。
最佳答案
以下链接可能会引导您走向正确的方向:http://code.shabz.co/post/32051014482/ios-6-supportedorientations-with-uinavigationcontroller
基本上,您需要子类化 UINavigationController 并让它监听其 topViewController
的 -supportedInterfaceOrientations
中的更改。您可以在博客文章中下载一个示例类,并且还解释了要添加的代码。
关于iphone - 我无法理解iOS6中的旋转机制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12669250/