开发者

iPhone - Five independent but simultaneous Countdown timers

开发者 https://www.devze.com 2023-02-07 03:24 出处:网络
Any tips on making five independent but simultaneous Countdown timers from 2 minutes do开发者_JS百科wn to 0, and then restarts at 2 min. And, whenever a user hits a reset button for each timer, that t

Any tips on making five independent but simultaneous Countdown timers from 2 minutes do开发者_JS百科wn to 0, and then restarts at 2 min. And, whenever a user hits a reset button for each timer, that timer would reset to 2 min...

And, an alarm should sound when each timer reaches countdown below 10 sec..

Any help would be greatly appreciated!

:-)

Cheers, loulou


How precise do you need your timers to be? If you can live with a tiny bit of uncertainly, go with NSTimers. Basically, you schedule 5 instances of NSTimer on your runloop. Each time through the loop, your app will check if a timer has fired, and perform some method if this is the case.

The nice thing about this approach is that you do not need to synchronize across multiple threads. You can schedule all of the timers on the main thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消