简体   繁体   English

iOS6首选界面方向不起作用

[英]iOS6 Preferred Interface Orientation Not Working

I'm trying to work with the iOS6 Auto-rotation mess. 我正在尝试使用iOS6自动旋转混乱。

I've looked at almost every single SO question relating to it, and no matter what I try, I can't get rotation working how I need it. 我已经研究了几乎所有与之相关的SO问题,无论我尝试什么,我都无法根据需要进行轮换工作。

The app is using storyboards, and the layout is as follows: 该应用程序正在使用情节提要,其布局如下:

Navigation controller ---> Root view controller ---> Tab view controller ---> View controller ---> Landscape view controller.

The view controller auto-rotates when I rotate the simulator, but when segueing back to the previous view (that is set to portrait), the view becomes landscape, when it should be portrait. 当我旋转模拟器时,视图控制器会自动旋转,但是当切换回上一个视图(设置为纵向)时,该视图将变为横向,而应为纵向。 If I rotate the simulator back, the view auto-rotates to portrait again, but this should've been done automatically! 如果我将模拟器向后旋转,则视图会再次自动旋转为纵向,但这应该是自动完成的!

I've implemented (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation and it doesn't get called in any view controller I put it in. 我已经实现了(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation并且在放入它的任何视图控制器中都不会调用它。

I've subclassed the NavigationController to return the topViewController 's shouldAutoRotate , supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation and auto-rotation when rotating the simulator seems to work, but preferredInterfaceOrientationForPresentation never does its job. 我子类的NavigationController返回topViewControllershouldAutoRotatesupportedInterfaceOrientationspreferredInterfaceOrientationForPresentation和自动旋转旋转模拟器似乎何时工作,但preferredInterfaceOrientationForPresentation从未完成它的工作。

Does anyone have a solution to this? 有人对此有解决方案吗?

It would appear Apple have removed the ability to push a view in a specific orientation. 苹果似乎已经删除了按特定方向推送视图的功能。 preferredInterfaceOrientationForPresentation does get called, but only when popping back or presenting a view controller. 不会调用preferredInterfaceOrientationForPresentation ,但仅在弹出或显示视图控制器时才调用。 I had to present my landscape view rather than push it, and set shouldAutoRotate = NO. 我不得不展示我的风景视图而不是推送它,并设置shouldAutoRotate = NO。

Refer to: In iOS6, trouble forcing ViewController to certain interfaceOrientation when pushed on stack for more details. 请参阅: 在iOS6中,将ViewController推入堆栈时强制将ViewController强制为特定的interfaceOrientation,以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM