我目前正在为 iOS 7+ 和 XCode 6 开发一款 SpriteKit 游戏。该游戏应始终以纵向模式呈现。到目前为止,我已经在我的 View Controller 中实现了这些方法:
- (BOOL)shouldAutorotate {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
只要我在纵向模式下手持 iPad 启动应用程序,它就可以正常工作。它不会在游戏过程中切换方向。
但在应用程序启动期间横向握住 iPad 时,游戏会横向显示。
即使设备在启动期间处于横向模式,我如何强制应用以纵向模式显示?
最佳答案
解决应用方向问题
Go to your projects plist file (should be "YourApp-Info.plist")
Add a row and enter "Supported interface orientations"
Add the orientations that your app supports
关于iOS+SpriteKit : How to force portrait mode?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30028537/