我有一个旧的iPad应用程序,它仅以横向显示。我试图在iOS 6中运行相同的应用程序,并且应用程序以纵向模式启动,与视图控制器方向设置无关。我知道iOS 6中有变化,如下所示。我的iOS应用程序中的方向问题
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft;
}
虽然我在代码中有这些行,但似乎并没有改变方向。 我还注意到,主窗口xib窗口处于纵向模式。是否有可能改变窗口的方向或是由于其他原因?
您使用的方向NavigationController在你的应用程序?如果是这种情况,那么navigationController会妨碍你的方向。另外'shouldAutorotateToInterfaceOrientation'在iOS6中已被弃用。 – nsgulliver