Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
关于制作五个独立但同时的倒数计时器的任何提示,从 2 分钟降至 0,然后在 2 分钟重新开始。而且,每当用户为每个计时器点击重置按钮时,该计时器将重置为 2 分钟......
并且,当每个计时器达到低于 10 秒的倒计时时,应该会响起警报。
任何帮助将不胜感激!
:-)
干杯,楼楼
你需要你的计时器有多精确?如果您可以忍受一点点不确定性,请选择 NSTimers。基本上,您在 runloop 上安排了 5 个 NSTimer 实例。每次循环时,您的应用程序都会检查计时器是否已触发,如果是,则执行某些方法。
这种方法的好处是您不需要跨多个线程进行同步。您可以在主线程上安排所有计时器。