I am trying to add a background image in my view controller so my sprite kit game scenes can be in the foreground. It's important for me for my background image to stay on screen while the game scenes transition to each other. The problem I am having is how to place the subview I created for my background to be behind my skscene, at the moment my background image is in front of my game scene and all you can see is the image sendSubviewToBack
doesn't seem to work. The following is my viewDidLoad Thanks
import UIKit
import SpriteKit
class GameViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let scene = MainMenuScene(size: CGSize(width: 1536, height: 2048))
let skView = self.view as! SKView
scene.scaleMode = .AspectFill
skView.presentScene(scene)
let backgroundImageView = UIImageView(image: UIImage(named: "bg.jpg"))
backgroundImageView.frame = view.frame
backgroundImageView.contentMode = .ScaleAspectFill
view.addSubview(backgroundImageView)
view.sendSubviewToBack(backgroundImageView)
}
}