核心就是在控制器中创建计时器,然后在模型中倒计时时间
//计时器 - (void)setUpTimer { self.timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerEvent) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; } - (void)timerEvent { for (CZHCountDownModel *timeModel in self.timeArrays) { if (timeModel.startTime - timeModel.currentTime <= 0) { continue; } [timeModel countDown]; [[NSNotificationCenter defaultCenter] postNotificationName:CZHUpdateTimeNotification object:nil]; } }demo下载链接
博客地址
简书地址