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?
However, the window was not visible on their screen. If you use a secondary monitor, and/or if you operate within a remote desktop environment, you may have experienced this issue.
They confirmed in the taskbar that the application was running. However, the window was not visible on their screen. If you use a secondary monitor, and/or if you operate within a remote desktop environment, you may have experienced this issue.
With the monitor disconnected from your computer, turn it on and off. If the display shows diagnostic information of any kind, you know the display is powered and is capable of displaying content. Verify that your PC has completely restarted and is powering-up from a completely powered-off state.
If the display shows diagnostic information of any kind, you know the display is powered and is capable of displaying content. Verify that your PC has completely restarted and is powering up from a completely powered off state. See how to restart your computer if you need help.
It's because you are displaying white text on a white background. Try this:
newGameNode.fontColor = [SKColor blackColor];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With