2

我在 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);
}
4

1 回答 1

6

感谢@shawnwall 评论,我意识到我没有根视图控制器。过去我的应用程序支持 yo iOS 3.1.3 O_O:

[self.window addSubview:self.viewController.view];

我很久以前就放弃了 3.1.3 支持,所以我可以设置一个根视图控制器:

self.window.rootViewController = self.viewController;

这就是导致视觉错误的原因。

于 2013-09-17T19:42:14.760 回答