我有一个几乎总是纵向的 Storyboard应用程序。我确实有一个需要处于横向模式的导航 Controller (带有 2 个 View Controller )。它连接回应用程序的主选项卡 Controller ,应用程序中的所有其他 View Controller 和导航 Controller 都需要保持纵向模式。我已经尝试将方向设置为横向并允许左右方向,但这会解锁所有 View Controller 以切换到横向模式。有没有办法只允许这 2 个?
感谢您的帮助! 本
最佳答案
您必须在应用程序的每个 View Controller 中子类化 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
并且只允许它用于 2 个 View Controller 。
但是对于你的标签栏,当你呈现那些 View Controller 时,你还需要将它设置为 YES(你可能需要子类化标签栏来做到这一点),否则为 NO
关于iphone - 只有一个导航 Controller (和 subview Controller )处于横向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12485871/