I have an issue where my SKView's background color (grey) is briefly being displayed before the scene is presented.
I manually attempted to set it, both via the Storyboard editor and in my controller (self.skView.backgroundColor = [SKColor blueColor]
) but it remains grey. Is this not an attribute that can be overridden?
Update #1
Here's a little explanation as to what happening:
viewDidLoad
is called andskView
is presented on the screen w/ a grey background (skView.scene
is not set yet).- I load all of the game's assets (which takes ~1 second) and during this point the grey background is visible.
- After the assets have been loaded I load the scene and present it (the grey screen is replaced w/ the contents of the scene)
ViewController
- (void)viewDidLoad
{
[self.activityIndicator startAnimating];
[self authenticatePlayer];
self.skView.backgroundColor = [SKColor blueColor];
// During this time the grey screen is visible as the assets are being loaded and take ~1 second
// self.skView.scene is NULL here so I cannot set the backgroundColor...
[GamePlayScene loadSceneAssetsWithCompletionHandler:^{
[self.activityIndicator stopAnimating];
self.activityIndicator.hidden = YES;
CGSize viewSize = self.skView.bounds.size;
self.gamePlayScene = [[GamePlayScene alloc] initWithSize:viewSize];
self.adView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.skView presentScene:self.gamePlayScene];
}];
...
self.skView.scene
is null for a brief period (see my updated question). – Brittaneybrittani