Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SKColor clearColor returning a black color instead?

I have setup my SKScene the following way during initiation:

-(id)initWithSize:(CGSize)size {
    if (self = [super initWithSize:size]) {


        self.backgroundColor = [SKColor clearColor];

    }
    return self;
}

But somehow, what I am given is the following, which is black, not clear at all: enter image description here

What am I missing here? How can I make this scene clear? I have already made the view holding the scene clear yet this is still what I get.

Update: I have also tried setting myView.opaque = NO; but this did not help at all.

like image 636
vzm Avatar asked Nov 05 '13 01:11

vzm


2 Answers

After try many things, this worked for me

skView.allowsTransparency = true
skView.backgroundColor = UIColor.clear
view.addSubview(skView)
floatingCollectionScene = BubblesScene(size: skView.bounds.size)
floatingCollectionScene.backgroundColor = UIColor.clear
floatingCollectionScene.scaleMode = .resizeFill
skView.presentScene(floatingCollectionScene)
like image 58
Javier Roberto Avatar answered Oct 13 '22 12:10

Javier Roberto


iOS 8 supports transparency:

skView.allowsTransparency = YES;
like image 28
VaporwareWolf Avatar answered Oct 13 '22 12:10

VaporwareWolf