Making a SKScene's background transparent not working... is this a bug? Making a SKScene's background transparent not working... is this a bug? ios ios

Making a SKScene's background transparent not working... is this a bug?


In iOS 8, you can set the scene's SKView to allow transparency and set the scene's background color to have transparency. Then views behind the SKView will be seen.

UIView *parentView = ...;[parentView addSubview:backgroundView];[parentView addSubview:skViewWithScene];skViewWithScene.allowsTransparency = YES;scene.backgroundColor = [UIColor clearColor];[skViewWithScene presentScene:scene];


Transparency works only for iOS 8, have to check for iOS 7

In the ViewController set transparency as :

SKView *skView = (SKView *)self.mySKView;SKScene *skScene = [MyScene sceneWithSize:skView.bounds.size];skScene.scaleMode = SKSceneScaleModeAspectFill;skView.allowsTransparency = YES;[skView presentScene: skScene];

In MyScene.m set background as clear color:

self.scene.backgroundColor = [UIColor clearColor];


swift 3

@IBOutlet var gameScene: SKView!func setupGameScene(){    if let scene = SKScene(fileNamed: "GameScene") {        scene.scaleMode = .aspectFill        scene.backgroundColor = .clear        gameScene.presentScene(scene)        gameScene.allowsTransparency = true        gameScene.ignoresSiblingOrder = true        gameScene.showsFPS = true        gameScene.showsNodeCount = true    }}