今天我注意到一个非常奇怪的事情,而不是我要显示的标签0我得到一个白色块,即使fontColor设置为黑色
// In MPSingleton
let gameFontRegular = UIFont(name: "HelveticaNeue", size: 1.5)
func addText(withText: String, textcolor: UIColor) -> SKLabelNode {
let label = SKLabelNode(fontNamed: MPSingleton.shared.gameFontRegular?.fontName);
label.text = withText;
label.fontColor = textcolor
label.fontSize = self.btnSize/4
label.horizontalAlignmentMode = SKLabelHorizontalAlignmentMode.Center;
label.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center;
label.zPosition = 122;
return label
}
但这种情况经常发生,而且我不知道为什么?
//更新1
var scoreInt: SKLabelNode!
scoreInt = addText("\(score)", textcolor: MPSingleton.shared.bgColor)
self.gameOverNode.addChild(scoreInt)
//更新2 而不是最佳得分:30,有一个白色的空白区域,文本的颜色是#666666,而fontSize = 20.7142857142857