我在App Store中有一个钢琴应用程序。它在横向模式下工作。
现在,iOS 7似乎正在忽略IB中的“风景”设置
该应用程序可以在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;
那是导致视觉错误的原因。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句