I have a countdown timer that displays the number of seconds remaining on the audio track. For some reason, the countdown is not calculated at intervals of 1 second, but 2 seconds on the first count, and then 1 second on the next count. (He counts in this pattern - he jumps 2 seconds, then 1 again and again).
here is my code:
- (void)updateTimeLeft {
NSTimeInterval timeLeft = self.player.duration - self.player.currentTime;
self.timeDisplay.text = [NSString stringWithFormat:@"%.2f", timeLeft / 60];
}
and here is my NSTimer:
NSTimer * myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTimeLeft) userInfo:nil repeats:YES];
Thanks for any help.
source
share