为什么这不改变标签的颜色?

Why isn't this changing the color of the label?

我正在尝试用这个更改 sprite kit 中的标签颜色:

    score = SKLabelNode(fontNamed: "Arial")
    score.text = "Test/(addScore)"
    score.color = SKColor.blackColor()
    score.fontSize = 20
    score.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame))
    addChild(score)

但它仍然是白色的。关于为什么它不是黑色的任何想法?

SKLabelNode的color属性是label的blend颜色。如果你想改变字体颜色你应该使用 fontColor 属性:

score.fontColor = SKColor.blackColor()

文档: https://developer.apple.com/library/prerelease/ios/documentation/SpriteKit/Reference/SKLabelNode_Ref/index.html#//apple_ref/occ/instp/SKLabelNode/fontColor