Invalidating a nstimer

by  |  19-Dec-2019 04:58

oh, wait.” If you want to follow me, I’m @zpasternack on Twitter and on

If you would like to see an example of NSTimer in use, please see: Create falling objects in your i OS Application using NSTimer “You use the Objective-C NSTimer class to create timer objects or, more simply, timers.

If you take a look at the Timer Programming Topics article, it’s divided into two parts: – Timers – Using Timers For articles that take this format, there is often an overview of the class and what it’s used for, and then some sample code on how to use it, in this case in the “Using Timers” section.

Each i OS application creates at least one NSThread object (the Main Thread) which represents the thread of execution of the application code.

Each continuously executes a loop in which it checks for input events.

One of the events that is checked for is the ‘timer interval elapsed event’.

When the run loop detects this kind of event it will fire the method on the target associated with the timer. The reason: there is a point in the loop () in which the timer events are managed.

If you want to stop a timer that is one which repeats, (or stop a non-repeating timer before it fires) then you need to keep a pointer to the NSTimer instance that was created; often this will need to be an instance variable so that you can refer to it in another method.

Community Discussion