iOS6自动旋转。 TabBar-> Navigation-> Modal
我已经阅读了几乎所有关于新的iOS6 autorotation的答案,但我仍然无法做到我想要的。iOS6自动旋转。 TabBar-> Navigation-> Modal
我有一个tabBar。其中一个选项卡是NavigationView。当你把iPhone变成风景时,一个modalViewController被加载。
一切工作正常在iOS5上,但我不能让模态视图旋转在iOS6上。我已经尝试了继承导航控制器,继承tabbar控制器和两个!没门。
我现在很困惑。哪一个是负责旋转模态视图? tabbarController?,navigationViewController?,viewController是谁展示的?
我很感激任何帮助。
由于
在iOS6的,你必须改变应用程序的旋转。 application.statusBarOrientation = UIInterfaceOrientationLandscapeLeft;
它的工作原理!我知道这只是一种解决方法,但它节省了我的一天。谢谢。 :d – rmvz3
自转在IOS 6 正在改变在iOS 6中,的UIViewController的shouldAutorotateToInterfaceOrientation:方法已被弃用。取而代之,您应该使用supportedInterfaceOrientationsForWindow和shouldAutorotate方法。
更多的责任是转向应用程序和应用程序委托。现在,iOS容器(例如UINavigationController)不会咨询他们的孩子以确定他们是否应该自动旋转。默认情况下,应用程序和视图控制器支持的界面方向设置为iPad的成语为UIInterfaceOrientationMaskAll,iPhone成语的设置为UIInterfaceOrientationMaskAllButUpsideDown。
视图控制器支持的界面方向可以随时间变化 - 即使应用程序支持的界面方向可能随时间而改变。无论何时设备旋转或每当视图控制器呈现全屏模式演示风格时,系统都会询问其支持的接口方向的最顶级全屏视图控制器(通常是根视图控制器)。此外,仅当该视图控制器从其shouldAutorotate方法返回YES
时,才会检索支持的方向。系统将视图控制器支持的方向与应用支持的方向(由Info.plist
文件或应用代理的application:supportedInterfaceOrientationsForWindow:方法确定)相交以确定是否旋转。
系统通过将应用程序的supportedInterfaceOrientationsForWindow:方法返回的值与最顶级全屏控制器的supportedInterfaceOrientations方法返回的值相交来确定是否支持方向。
setStatusBarOrientation:animated:方法不完全弃用。它现在只在最顶级全屏视图控制器的supportedInterfaceOrientations方法返回0
时起作用。这使得调用者负责确保状态栏方向一致。
为了兼容性,仍然实现shouldAutorotateToInterfaceOrientation:方法的视图控制器不会获得新的自动旋转行为。 (换句话说,它们不会退回到使用应用程序,应用程序委托或Info.plist
文件来确定支持的方向。)相反,shouldAutorotateToInterfaceOrientation:方法用于合成supportedInterfaceOrientations方法将返回的信息。
的willRotateToInterfaceOrientation:duration:,willAnimateRotationToInterfaceOrientation:duration:,和didRotateFromInterfaceOrientation:方法不再调用的任何视图控制器,使一个全屏幕呈现在其自身上,例如,presentViewController:animated:completion:上。
您应该确保您的应用程序不使用这些方法来管理任何子视图的布局。相反,他们应该使用视图控制器的方法viewWillLayoutSubviews并使用视图的边界矩形调整布局。
希望这可以帮助你
[self presentModalViewController:newController animated:YES];在iOS6中不推荐使用,试试[self presentViewController:newController animated:YES completion:nil]; – Bala
我期待着看到这个答案。我也有同样的问题。 – ppaulojr