Landscape Apps Xcode 5 / iOS 7
我在App Store里有一个钢琴应用程序。 它适用于横向模式。
现在iOS 7似乎忽略了IB中的Landscape设置
该应用程序在iOS 6及更低版本中以预期的方式工作。 在iOS 7中出现在肖像中。 以下是设置和相关代码:
//iOS 6+ - (BOOL)shouldAutorotate { return YES; } //iOS 6+ - (NSUInteger)supportedInterfaceOrientations { return (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight); } //iOS 5.1.1- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); }
感谢@shawnwall评论,我意识到我没有Root View Controller。 在过去我的应用程序给予支持iOS 3.1.3 O_O:
[self.window addSubview:self.viewController.view];
我很久以前就放弃了3.1.3支持,所以我可以设置一个根视图控制器:
self.window.rootViewController = self.viewController;
这就是导致视觉错误的原因。