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.
|
|
@interface NSTimer : NSObject
|
// Convenience Constructors
|
+ (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo; |
+ (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo; |
// Initializers
|
- (id)initWithFireDate:(NSDate *)date interval:(NSTimeInterval)ti target:(id)t selector:(SEL)s userInfo:(id)ui repeats:(BOOL)rep; |
// Accessor Methods
|
- (void)setFireDate:(NSDate *)date; |
- (NSDate *)fireDate;
|
// Class Methods
|
+ (NSTimer ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access