![](/img/trans.png)
[英]IOS7 Xcode 5 universal app won't rotate on iphone, but will on ipad
[英]iOS: Universal app won't rotate, never calls willRotateToInterfaceOrientation
我的(通用iPhone / iPad)应用程序不会旋转。 在我所有的视图控制器中,我都对方法shouldRotate返回“ YES”,但是我的视图控制器的willRotateToInterfaceOrientation方法从未得到调用。
这是常见问题吗?
在该通用应用程序中,您是否使用splitViewController? 如果是这样,请确保所有viewControllers返回Yes都应为autoRotate。
我将一个viewControllers(实际上是NavigationViewControllers)数组传递给splitViewController,而我的视图没有旋转。 这是因为我的左手viewController没有实现shouldAutorotate。 我认为这是因为使用splitViewController时,iPad上的旋转不同于iPhone上的旋转。 旋转时显示两个viewControllers。 我猜两者都必须支持横向模式?
如果您不希望一个viewController的旋转旋转,请执行条件检查,以查看shouldAutoRotate方法是否在iPad上。
您是否在使用标签栏? 您将需要对Tabbar控制器进行子类化,并在旋转时返回yes。
我刚遇到这个。 解决方案是将UISplitViewController子类化并添加
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
即使各个视图控制器已经返回YES,也要等到我添加拆分视图控制器子类后,它才起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.