iPhone - 五个独立但同时进行的倒计时器
关于制作五个独立但同时倒数计时器的任何提示,从 2 分钟减到 0,然后在 2 分钟重新启动。而且,每当用户按下每个计时器的重置按钮时,该计时器就会重置为 2 分钟...
而且,当每个计时器倒计时低于 10 秒时,应该发出警报。
任何帮助将不胜感激!
:-)
干杯, 楼楼
Any tips on making five independent but simultaneous Countdown timers from 2 minutes down 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要计时器有多精确?如果你能忍受一点点不确定性,那就选择 NSTimers。基本上,您在运行循环上安排了 5 个 NSTimer 实例。每次循环时,您的应用程序都会检查计时器是否已触发,如果是这种情况,则执行某种方法。
这种方法的好处是您不需要跨多个线程进行同步。您可以在主线程上安排所有计时器。
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.