Name

NSTimer — Mac OS X 10.0

Synopsis

This class represents a timer in the run-loop that can be used to invoke a method in a target after some elapsed time, or at regularly spaced intervals. The most straightforward way of creating a time is to use the method scheduledTimerWithTime-Interval:target:selector:userInfo:repeats:, which creates the timer and add it to the current run-loop in the default mode. To remove a timer from its run-loop and stopping it from firing again, send an invalidate message to the timer object.

NSTimer is toll-free bridged with the Core Foundation type CFRunLoopTimer. As such, NSTimer objects can be used interchangeably with the CFRunLoopTimer pointer type, CFRunLoopTimerRef.

The timer doesn’t have good resolution; its accuracy is a function of the run-loop and what’s on it.