iOS+SpriteKit : How to force portrait mode?

标签 ios sprite-kit orientation screen-orientation uiinterfaceorientation

我目前正在为 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/

相关文章:

ios - 在 SpriteKit 游戏中每 n 秒添加一个 "life"(钢琴 block 的方式)

Android 屏幕方向因设备而异

math - 对齐 IMU 方向,然后获得相对旋转

iphone - 在 iOS 中将字符发布到服务器

ios - Swift 中自定义函数内的按钮操作

iphone - 如何将数组元素添加到已包含另一个数组值的 NSMutableArray?

ios - 使用执行选择器但带有参数创建 SKAction

swift : How to handle a lot of textures in memory

ios - 如何以编程方式 "like"iOS 应用程序中的 Facebook 页面?

iPhone - 即使应用程序仅支持纵向,状态栏也会旋转