Introduction to Timers

Explains how to use timers for scheduling automatic, repeating message invocations in Cocoa.

At a Glance

Timers work in conjunction with NSRunLoop objects. As a result, they don’t provide a real-time mechanism—their accuracy is limited.

For more about timers in general, see Timers .

There are several aspects to using a timer. When you create a timer, you must configure it so that it knows what message to send to what object when it fires. You must then associate it with a run loop so that it will fire—some of the creation methods do this for you automatically. Finally, if you create a repeating timer, you must invalidate it when you want it to stop firing.

To learn more about using timers, see Using Timers .

Next

Copyright © 2009 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2009-07-14