Is there a way to remove the initial delay on an NSTimer
? The following code is for my timer, which is all fine.
NSTimer *timer;
timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updateTime) userInfo:nil repeats:YES];
However, the method does not run for the first 5 seconds. I would like my method (updateTime
) to run on the following timeline from 00:00:00 when the app is opened.
Currently, it only does:
You can't make a timer fire before its time interval has elapsed, but you can do this:
NSTimer *timer;
timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updateTime) userInfo:nil repeats:YES];
[self updateTime];