在我的應用程序中,我讓用戶使用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