【发布时间】:2014-03-29 23:14:46
【问题描述】:
我遇到了一个问题,即我的 SKView 的背景颜色(灰色)在呈现场景之前会短暂显示。
我通过 Storyboard 编辑器和我的控制器 (self.skView.backgroundColor = [SKColor blueColor]) 手动尝试设置它,但它仍然是灰色的。这不是可以被覆盖的属性吗?
更新 #1
下面是关于发生了什么的一点解释:
-
viewDidLoad被调用,skView以灰色背景显示在屏幕上(skView.scene尚未设置)。 - 我加载了游戏的所有资源(大约需要 1 秒),此时灰色背景可见。
- 加载资产后,我加载场景并呈现它(灰屏被场景内容替换)
视图控制器
- (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];
}];
...
【问题讨论】:
标签: ios objective-c ios7 sprite-kit skview