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

前端 未结 5 728
挽巷
挽巷 2020-12-03 06:52

Is there a way to make a SKScene\'s background transparent and present that scene over another one seeing thru the transparency.

The idea is to have the background o

5条回答
  •  日久生厌
    2020-12-03 07:22

    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];
    

提交回复
热议问题