In Objective-C How Do I Increase a Number Displayed by UILabel Gradually?
<p>Say I want to increase a number displayed by UILabel from 0%</p>

<pre><code>UILabel *percentage.text = [NSString stringWithFormat:@" %ld%%", 0];
</code></pre>

<p>to 50% in 2 seconds.</p>

<pre><code>percentage.text = [NSString stringWithFormat:@" %ld%%", 0]
</code></pre>

<p>Here is what I tried to use NSTimer:</p>

<pre><code>self.percent = 0;
self.timer = [NSTimer timerWithTimeInterval:0.04
                                     target:self 
                                   selector:@selector(updateLabel) 
                                   userInfo:nil
                                    repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];

//updateLabel
- (void)updateLabel{
    self.percentage.text = [NSString stringWithFormat:@" %ld%%", self.percent++];
    if (self.percent &gt; 50) {
        [self.timer invalidate];
        self.timer = nil;
    }
}
</code></pre>

<p>But the UI looks very jerky, not smooth at all looks like all the changes are stacked and will apply sometimes but not sure when, and its taking definitely longer than 2 seconds. Is this because that 0.04 sec is too short?</p>

<p>Is there a better way to do it?</p>