I wrote a function called updateLabel to count up my collected coins over time. I call that function using a NSTimer to get the counting up effect.
Everything works great using iOS 8 but as soon as I call the function using iOS 7.1 my Label just turns blank... If I print out the Label.text I get the right number but it just does not show. Even the sound "coinSound" works.
scoreLabel = SKLabelNode()
scoreLabel.text = "0"
self.addChild(scoreLabel) // shows up and works with "0"
self.timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target: self.self, selector: "updateLabel", userInfo: nil, repeats: true)
func updateLabel() {
var score:Int = coinsCollected
var current:Int = self.scoreLabel.text.toInt()!
if (current < score) {
current += 1
scoreLabel.text = String(current)
println("current: \(current) , labelText: \(scoreLabel.text)")
self.runAction(coinSound)
} else {
timer.invalidate()
}
}
Thanks for your help