C / iPhone goal: how to add a timer to update text?

I want to write an application that allows the user to count the time. The time will be displayed using a mark. I want to update a shortcut every second, how can I do this? or which API is right for me? thz in advance.

+4
source share
1 answer
- (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;)

+3
source

Source: https://habr.com/ru/post/1304477/


All Articles