objective c - NSTimer jumping 2 seconds -


Please help,

I have an NSTimeInterval which I convert to an NSDateComponent and then Assign each component (year, month, day, etc.) for a proper label. After conversion, I start an NSTimer to start the countdown. Here the code is used:

  - (zero) Configure view {if (self.detailItem) {self.progressView.progress = 0.0; Self.initialInterval = [[self.detailItem value forKey: @ "date"] time in the current time]; Self.timeElapsed = self.initialInterval; Self.secondsLeft = [Auto reset Laba]; NSTimer * Timer = [NSTimer Scheduled Timer With Time Interval: 1 Goal: Self Selector: @Selector (TimerFire Mode) User Information: Zero Repeats: Yes]; }} - (zero) timerfire method: (NSTimer *) timer {if (self.secondsLeft> 0) {self.secondsLeft--; Self.timeElapsed--; [Self update SecondsWithNumber: self.secondsLeft]; Self.progressview.progress = 1 - (Auto Timeout / self.initialInterval); } And (if (self-timed eclipse & lt; = 0) {[invalid timer]; return;} [auto reset labels]; self.secondsLeft = 59;}} - (zero) updateswith countersWindand: (int) number {self .secondLabel.text = [NSString stringWithFormat: @ "% ds", number];} - (NSTimeInterval) reset labels {NSDateComponents * convertedInfo = [ChronoModel dateComponentFromTimeInterval: self.timeElapsed]; Self.yearLabel.text = [NSString stringWithFormat: @ "% Ldy", (long) Converted Info.year] Self.monthLabel.text = [NSString stringWithFormat: @ "% ldm", (long) Converted Infos. Month]; Self.dayLabel.text = [NSString stringWithFormat: @ " % Ldd ", (long) converted infos. De]; self.hourLabel.text = [NSString stringW IthFormat: @ "% ldh", (long) converted infos. Hor]; Self.minuteLabel.text = [NSString stringWithFormat: @ "% ldm", (long) Converted INFO.minute]; Self.secondLabel.text = [NSString StringWithFormat: @ "% lds", (long) converted infos.second; return conversion.second;}  

timed out, initial intervals and seconds are all NSTimeIntervals left.

For any reason the label jumps two seconds instead of just one. I have no idea why this is happening. any idea?

Thanks

My best estimate is that you have to run a timer Examples are: Try entering an NSLog before [NSTimer Scheduled Timer with TimeTimeTurnart line.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -