我在AppStore上有一个应用程序,它在iPhone和iPad上具有纵向模式,它可以在横向上工作。但是,我收到报告称它在iPad 1上显示肖像,因此破坏了整体视图。
为什么 iPad 1 专门显示纵向模式?iPad 的版本是 5.1.1
在 ios 6 中,支持界面面向的方法已更改。为了在两个版本中支持两个接口方向,我们需要检查操作系统版本并协调编写代码。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
支持新版本
- (NSUInteger)supportedInterfaceOrientations {
}
- (BOOL)shouldAutorotate {
}
在我的视图控制器中,我有以下内容:
- (NSUInteger)supportedInterfaceOrientations {
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
}
- (BOOL)shouldAutorotate {
}
确保所有视图控制器返回它们支持的正确方向模式。我在iOS 5中看到过这种行为,如果我没记错的话,这就是原因。
我有一个非常相似的问题,我通过在AppDelegate.m->应用程序中更改以下代码来解决它:
[self.window addSubview:self.viewController];
自
[self.window setRootViewController:self.viewController];