Suppose for a minute.
Here is a simple scenario
int remainingCounts; NSTimer *timer; timer = [NSTimer scheduledTimerWithTimeInterval:1 target:(self) selector:@selector(countDown) userInfo:nil repeats:YES]; remainingCounts = 60;
The method is called every second.
-(void)countDown { NSLog(@"%d", remainingCounts); // Do Your stuff...... if (--remainingCounts == 0) { //[self dismissViewControllerAnimated:YES completion:nil]; [timer invalidate]; } }
source share