我的应用程序应该只是横向的,在构建时我没有遇到任何问题iOS 6和更早的时候。现在与iOS 7,它根本不会旋转。
在我的应用程序设置中,我将其设置为仅横向左/右。在我的视图控制器中,我使用以下内容:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
我也曾经使用过这个,现在已被弃用:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
return UIInterfaceOrientationIsLandscape(orientation);
}
新的似乎是 shouldAutorotate,但使用它会使我的应用程序崩溃。任何关于这方面的想法将不胜感激,因为我的应用程序被迫在我的 iPad 和模拟器中呈现肖像。谢谢你!
这解决了我的问题。我不确定为什么我之前遇到过问题,但我一定错过了尝试这种精确的组合(另外,info.plist 应该设置支持的方向)。
(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
(BOOL)shouldAutorotate {
return YES;
}
编辑:我可能对模拟器有问题,并且进行重置/重新启动和清理可能有助于修复。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)