在专用界面中

   @property BOOL contentCreated

然后在执行中
//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];
}

但是当我运行时,屏幕上没有任何显示。我究竟做错了什么?

最佳答案

这是因为您在白色背景上显示白色文本。试试这个:

newGameNode.fontColor = [SKColor blackColor];

10-01 17:27