November 2013
Beginner
325 pages
9h 47m
English
Timers use a target-action mechanism. You create a timer with a time interval, a target, and an action. After the interval has elapsed, the timer sends the action message to its target.
You are going to add an instance of NSTimer to your program. Every two seconds, the timer will send the action message to its target. You will also create a class named BNRLogger. An instance of that class will be the timer’s target.
Figure 27.1 BNRLogger is the target of the NSTimer
Create a new file: an Objective-C class called BNRLogger that is a subclass of NSObject.
In BNRLogger.h, declare a property that holds a date, ...
Read now
Unlock full access