This is with iOS 9. I am unable to set the background color of an SKView, it always renders with the default grey. Is there a way around this?
let frame = CGRect(x: 0, y: 0, width: 200, height: 100)
let spriteView = SKView(frame: frame)
spriteView.backgroundColor = .blueColor()
self.view.addSubview(spriteView)
When the above code is run the SKView is grey instead of blue. What I really want to be able to do is set allowsTransparency = true
but I can't get that to work if I can't change the background color to clearColor
.
Anyone else running into this? Any workarounds?
Update
Even with @Danilo's suggestion, this still displays as grey:
let frame = CGRect(x: 0, y: 0, width: 200, height: 100)
let spriteView = SKView(frame: frame)
spriteView.backgroundColor = .clearColor()
spriteView.allowsTransparency = true
spriteView.opaque = false
Update
Apparently setting the backgroundColor
of an SKView has not effect, but if you do set it to anything then allowsTransparency = true
doesn't work.