这是一个非常小的场景,有白雪皑皑的背景以及居中的播放按钮。
如何让雪落在FRONT(可选择在我的按钮的前面和后面)?我似乎无法将UIButton与雪发射器混合搭配。如果我不需要,我宁愿不将按钮变成SKNode(除非那是'正确的'方式)......
class WelcomeViewController: UIViewController {
@IBOutlet weak var playButton: UIButton!
@IBOutlet weak var snowView: SKView!
override func viewDidLoad() {
super.viewDidLoad()
if let scene = WelcomeScene(fileNamed:"WelcomeScene") {
// Configure the view.
if let emitter = SKEmitterNode(fileNamed: "snow") {
emitter.position = CGPointMake(view.center.x, view.bounds.maxY + 20)
emitter.particlePositionRange = CGVector(dx: view.bounds.width + 20, dy: 10)
emitter.zPosition = 2
scene.addChild(emitter)
}
playButton.layer.cornerRadius = playButton.frame.size.height / 2
playButton.bringSubviewToFront(snowView)
/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill
snowView.presentScene(scene)
}
}