Reset an NSTimer's firing time to be from now instead of the last fire

前端 未结 5 593
面向向阳花
面向向阳花 2021-01-02 13:33

I have a NSTimer that fires with an interval of 3 seconds to decrease a value. When I do an action that increases that value, I want to restart the timer to cou

5条回答
  •  佛祖请我去吃肉
    2021-01-02 13:49

    Yes, invalidating and recreating the timer will work. It is essentially what you are wanting to do if you are not increasing your value: reset and start over.

提交回复
热议问题