在我的应用程序中,我让用户使用UIDatePicker's
CountDownTimer
设置了倒计时计时器。使用UIDatePicker在iOS中进行计时器倒计时
我有一个UILabel
显示计数时间当用户从CountDownTimer中选择时间时,我想显示在CoutDownTimer中选择的用户下来的coumt,如下图所示。
所以我检索用户从CountDownTimer
选择了与下面的代码
self.dateFormatter = [[NSDateFormatter alloc] init];
[self.dateFormatter setDateFormat:@"HH:mm:ss"];
self.sleepTimer = [NSTimer timerWithTimeInterval:1.00 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO];
当到达00:00,我想触发一个事件计数的时间。
我不知道如何减少每秒钟的计数。
谢谢你的帮助。
您需要'NSTimer'。 http://stackoverflow.com/questions/1449035/how-do-i-use-nstimer – graver 2013-02-26 13:28:36
是的,我知道,但我不知道如何减少1每秒 – 2013-02-26 13:29:20
你需要一个变量来减少每次计时器火灾直到它达到0. – graver 2013-02-26 13:30:07