SKColor clearColor returning a black color instead?

前端 未结 3 1063
温柔的废话
温柔的废话 2020-12-17 19:35

I have setup my SKScene the following way during initiation:

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


             


        
相关标签:
3条回答
  • 2020-12-17 19:41

    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)
    
    0 讨论(0)
  • 2020-12-17 19:50

    iOS 8 supports transparency:

    skView.allowsTransparency = YES;
    
    0 讨论(0)
  • 2020-12-17 19:57

    Setting it to clear is working correct, resulting in no colour, so black.

    Set to any colour you like via

    self.backgroundColor = [SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];
    
    0 讨论(0)
提交回复
热议问题