O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

23 NSTimer

As you learned in Chapter 5, controls have a target and an action. The target is a reference to another object; the action is a selector (essentially the name of the method to be called on the target). When a button is clicked, the action method is called on the target.

Timers work in a similar way. A timer is an object that has a target, a selector, and an interval, which is given in seconds (Figure 23.1). After the interval has elapsed, the action is called on the target. The sender in this case is the timer itself. The timer can also be set to send the message repeatedly.

Figure 23.1  NSTimer

NSTimer

To play with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required