您必须编辑GameViewController:
切一切从
viewDidLoad()除
super.viewDidLoad()
覆写
viewWillLayoutSubviews
override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { // Configure the view. var skView = self.view as SKView skView.showsFPS = true skView.showsNodeCount = true skView.ignoresSiblingOrder = true scene.size = skView.bounds.size scene.scaleMode = .AspectFill skView.presentScene(scene) }}
您还应该设置场景大小,如您所见
scene.size = skView.bounds.size
希望这可以帮助
还有一个很棒的教程,对它进行了更好的解释:http : //www.raywenderlich.com/49721/how-to-
create-a-breakout-game-using-
spritekit (第1章或第2章)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)