Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SKLabelNode not showing up on screen

Tags:

ios

sprite-kit

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?

like image 960
Lucas Avatar asked Jan 26 '14 21:01

Lucas


People also ask

Why is the window not visible on the screen?

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.

Why is the application not showing up on my screen?

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.

How do I know if my monitor is working or not?

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.

How do I know if my display is powered on?

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.


1 Answers

It's because you are displaying white text on a white background. Try this:

newGameNode.fontColor = [SKColor blackColor];
like image 180
Batalia Avatar answered Oct 04 '22 19:10

Batalia