0
當我開始玩測驗定時器開始「4 ... 3 ... 2 ... 1 ...」的倒計時。 我想在測驗的第一個問題中添加此倒計時。倒計時後顯示第一個問題。倒計時開始4至1
任何一個可以幫我請
我想要做這個,但我did'nt得到格式倒計時。
NSTimer *timer_total = [NSTimer scheduledTimerWithTimeInterval:1.0/10.0 target:self selector:@selector(updateTimer) userInfo:nil repeats:YES];
- (void)updateTimer
{
NSDate *currentDate = [NSDate date];
NSTimeInterval timeInterval = [currentDate timeIntervalSinceDate:startDate_total];
NSDate *timerDate = [NSDate dateWithTimeIntervalSince1970:timeInterval];
self.df_total = [[NSDateFormatter alloc] init];
[self.df_total setDateFormat:@"mm:ss"];
[self.df_total setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0.0]];
NSString *timeString=[self.df_total stringFromDate:timerDate];
self.lbl_total_Timer.text = timeString;
}