0

Today I notice a very strange thing, instead of the label that I want to display 0 I get a white block, even though fontColor is set to black

// 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

}

But this doesn't happen that often, and I don't know why?

// update 1

var scoreInt: SKLabelNode!

scoreInt = addText("\(score)", textcolor: MPSingleton.shared.bgColor)
self.gameOverNode.addChild(scoreInt)

// update 2 Instead of Best Score : 30, there is a white blank space, the color of the text is #666666 and with fontSize = 20.7142857142857

enter image description here

grape1
  • 759
  • 2
  • 8
  • 19

0 Answers0