Invalidating a timer

suggest change

Swift

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 timer has been invalidated, its impossible to fire same invalidated timer.Instead you need to initialise the invalidated timer again and trigger fire method.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents