开发者

iPhone - Five independent but simultaneous Countdown timers

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜