【问题标题】:iOS+SpriteKit: How to force portrait mode?iOS+SpriteKit:如何强制人像模式?
【发布时间】:2015-05-04 11:04:58
【问题描述】:

我目前正在开发适用于 iOS 7+ 和 XCode 6 的 SpriteKit 游戏。该游戏应始终以纵向模式呈现。到目前为止,我已经在我的视图控制器中实现了这些方法:

- (BOOL)shouldAutorotate {
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

只要我以纵向模式启动应用程序,我的 iPad 就可以正常工作。在游戏过程中它不会切换方向。

但在应用程序启动过程中将 iPad 保持为横向时,游戏会以横向显示。

即使设备在启动期间处于横向模式,我如何强制应用以纵向模式显示?

【问题讨论】:

    标签: ios sprite-kit orientation screen-orientation uiinterfaceorientation


    【解决方案1】:

    解决应用方向问题

    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 
    

    【讨论】:

    • 谢谢。 Info.plist 文件中有两个条目。一种通用的“支持的界面方向”和一种特定于 iPad 的“支持的界面方向 (iPad)”,我必须对其进行调整才能解决问题。
    • 为什么没有其他答案说这超出了我的范围。谢谢你:)
    猜你喜欢
    • 2013-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多