更新到 iOS7 后,我的应用程序显示自动旋转。我希望它是一个仅限横向的应用程序,因此,我将所有内容设置如下:在 iOS6 中很好。
在 .plist 文件中:
在我的MainWindow
控制器中
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
将AppDelegate.m
其称为:
MainViewController* mainViewController = [[MainViewController alloc] init];
// Create the navigation controller
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:mainViewController];
[navController setNavigationBarHidden:NO];
[[self window] setRootViewController:navController];
但是当我旋转设备时,应用程序仍会以纵向模式自动旋转。在 iOS 6 中我没有这样的行为。