Teo*_*rig 2 xcode landscape objective-c ios ios7
我在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);
}
Run Code Online (Sandbox Code Playgroud)
感谢@shawnwall评论,我意识到我没有Root View Controller.在过去我的应用程序给予支持iOS 3.1.3 O_O:
[self.window addSubview:self.viewController.view];
Run Code Online (Sandbox Code Playgroud)
我很久以前就放弃了3.1.3支持,所以我可以设置一个根视图控制器:
self.window.rootViewController = self.viewController;
Run Code Online (Sandbox Code Playgroud)
这就是导致视觉错误的原因.
| 归档时间: |
|
| 查看次数: |
6531 次 |
| 最近记录: |