Invalidating a timer
suggest changeSwift
timer.invalidate()
Objective-C
[timer invalidate];
This will stop the timer from firing. Must be called from the thread the timer was created in, see Appleās notes:
You must send this message from the thread on which the timer was installed. If you send this message from another thread, the input source associated with the timer may not be removed from its run loop, which could prevent the thread from exiting properly.
Notes: Once a timer has been invalidated, it is impossible to fire that same timer again. Create a new timer and schedule it.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents