2

Could anybody give me an advice how to show a smooth number increment in UILabel? The code I have used performs such increment too fast for human eye :)

for (int i = 1; i<=self.score; i++) {
    self.levelCompleteScoreLabel.text = [NSString stringWithFormat:@"%d", i];
} 

I can't use sleep() function because I have concurrent animations going on the screen.

logancautrell
  • 8,762
  • 3
  • 39
  • 50
Centurion
  • 14,106
  • 31
  • 105
  • 197

1 Answers1

6

Seems like an NSTimer will work well for what you are trying to do.

You can set it to fire say every one or 0.5 seconds so users can see and appreciate the change.

Here you will find a very easy way to implement it.

Additionally you can look at the answers for this question wich has a lot of information on NSTimer: How do I use NSTimer?

Community
  • 1
  • 1
Zebs
  • 5,378
  • 2
  • 35
  • 49