Reputation: 713
in a private interface
@property BOOL contentCreated
And then in the implementation
//just like in Apple's example project
- (void)didMoveToView: (SKView *) view {
if (!self.contentCreated) {
[self createSceneContents];
self.contentCreated = YES;
}
}
- (void)createSceneContents {
self.backgroundColor = [SKColor whiteColor];
self.scaleMode = SKSceneScaleModeAspectFill;
SKLabelNode *newGameNode = [[SKLabelNode alloc] initWithFontNamed:
@"Helvetica"];
newGameNode.name = @"NewGame";
newGameNode.text = @"New Game";
newGameNode.fontSize = 30;
newGameNode.fontColor = [SKColor whiteColor];
newGameNode.position = CGPointMake(100, 100);
[self addChild:newGameNode];
}
but when I run, nothing shows up on the screen. What am I doing wrong?
Upvotes: 5
Views: 1492
Reputation: 2425
It's because you are displaying white text on a white background. Try this:
newGameNode.fontColor = [SKColor blackColor];
Upvotes: 6