SpriteKit scene自适应

2017-08-22  本文已影响0人  loyoan

使用Xcode的Game模版,在GameViewController.swift中改写

if let scene = SKScene(fileNamed: "GameScene") {

// Set the scale mode to scale to fit the window

scene.size = UIScreen.main.bounds.size.applying(CGAffineTransform(scaleX: UIScreen.main.scale, y: UIScreen.main.scale))

//增加此行,即可获得设备真实像素大小的scene

scene.scaleMode = .aspectFill

// Present the scene

view.presentScene(scene)

}

上一篇下一篇

猜你喜欢

热点阅读