I want to write an application that allow user to count down the time. The time will be displayed using label. I want to update the label every second, how can I do it? or which API is suitable for me to do this? thz in advance.
+2
A:
- (IBAction)startCountdown:(id)sender
{
NSTimer *countdownTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(advanceTimer:) userInfo:nil repeats:YES];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
[runLoop addTimer:countdownTimer forMode:NSDefaultRunLoopMode];
}
- (void)advanceTimer:(NSTimer *)timer
{
[countdown setIntegerValue:59];
}
+1up ;)
Neurofluxation
2010-03-18 16:17:29