【发布时间】: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