I have a simple UILabel on that I want to change the text of every 10 seconds. What is the best way of doing this, which let's the rest of the interface remain active?
+1
A:
All you need is to start an NSTimer and update the label.text each time.
progrmr
2010-05-12 21:24:30
+3
A:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:10.0f target:self selector:@selector(updateLabel:) userInfo:nil repeats:YES];
self.repeatingTimer = timer;
...
- (void) updateLabel:(id)sender {
myLabel.text = newStringValue;
}
...
[repeatingTimer invalidate];
self.repeatingTimer = nil; // stops timer
Alex Reynolds
2010-05-12 21:26:55