【问题标题】:SpriteKit landscape orientation not workingSpriteKit横向不工作
【发布时间】:2017-12-19 21:01:49
【问题描述】:

每个人。我正在用 Xcode 9 和 swift 4 用 SpriteKit 制作一个应用程序,我希望游戏处于横向模式。

我已尝试在项目设置中设置为仅允许横向,并已在应用委托文件中添加了此代码。

    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
    //make device portrait unless it is the game view controller
    if self.window?.rootViewController?.presentedViewController is GameViewController {

        return UIInterfaceOrientationMask.landscape;

    } else {
        return UIInterfaceOrientationMask.portrait;
    }
}

但是这些都不起作用,SpriteKit 场景仍然是纵向加载的。如何让场景以横向方式加载。

【问题讨论】:

    标签: ios swift sprite-kit


    【解决方案1】:

    转到项目中的 info.plist,底部应该是两个元素,“支持的界面方向”和“支持的界面方向(iPad)”。单击下拉菜单并从两个元素中删除纵向模式方向。

    【讨论】:

    • 这没用游戏场景仍然是纵向加载
    • 是纵向加载的场景还是您的场景大小纵向但缩放奇怪
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多