我的应用程序应该只支持横屏,而在构建 iOS 6 及更早版本时,我没有遇到任何问题。 现在使用 iOS 7 时,它根本不会旋转。
在我的应用设置中,我将其设置为仅支持左/右横屏。 在我的视图控制器中,我正在使用以下代码:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
我以前也用过这个,但现在已经不推荐使用了:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
return UIInterfaceOrientationIsLandscape(orientation);
}
新的似乎是shouldAutorotate,但使用它会导致我的应用程序崩溃。有关此问题的任何想法将不胜感激,因为我的iPad和模拟器上都被强制保持竖屏。谢谢!