Type Method

scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:

Creates and returns a new NSTimer object and schedules it on the current run loop in the default mode.

Declaration

+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo;

Parameters

ti

The number of seconds between firings of the timer. If ti is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead.

target

The object to which to send the message specified by aSelector when the timer fires. The timer maintains a strong reference to target until it (the timer) is invalidated.

aSelector

The message to send to target when the timer fires.

The selector should have the following signature: timerFireMethod: (including a colon to indicate that the method takes an argument). The timer passes itself as the argument, thus the method would adopt the following pattern:

- (void)timerFireMethod:(NSTimer *)timer
userInfo

The user info for the timer. The timer maintains a strong reference to this object until it (the timer) is invalidated. This parameter may be nil.

repeats

If YES, the timer will repeatedly reschedule itself until invalidated. If NO, the timer will be invalidated after it fires.

Return Value

A new NSTimer object, configured according to the specified parameters.

Discussion

After ti seconds have elapsed, the timer fires, sending the message aSelector to target.

See Also

Creating a Timer

scheduledTimerWithTimeInterval:invocation:repeats:

Creates and returns a new NSTimer object and schedules it on the current run loop in the default mode.

timerWithTimeInterval:invocation:repeats:

Creates and returns a new NSTimer object initialized with the specified invocation object.

timerWithTimeInterval:target:selector:userInfo:repeats:

Creates and returns a new NSTimer object initialized with the specified object and selector.

initWithFireDate:interval:target:selector:userInfo:repeats:

Initializes a new NSTimer object using the specified object and selector.