Type Method

scheduledTimerWithTimeInterval:repeats:block:

Creates a timer and schedules it on the current run loop in the default mode.

Declaration

+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)interval repeats:(BOOL)repeats block:(void (^)(NSTimer *timer))block;

Parameters

interval

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

repeats

If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires.

block

A block to be executed when the timer fires.

The block takes a single NSTimer parameter and has no return value.

Return Value

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

Discussion

After interval seconds have elapsed, the timer fires, executing block.

See Also

Creating a Timer

+ scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:

Creates a timer and schedules it on the current run loop in the default mode.

+ scheduledTimerWithTimeInterval:invocation:repeats:

Creates a new timer and schedules it on the current run loop in the default mode.

+ timerWithTimeInterval:repeats:block:

Initializes a timer object with the specified time interval and block.

+ timerWithTimeInterval:target:selector:userInfo:repeats:

Initializes a timer object with the specified object and selector.

+ timerWithTimeInterval:invocation:repeats:

Initializes a timer object with the specified invocation object.

- initWithFireDate:interval:repeats:block:

Initializes a timer for the specified date and time interval with the specified block.

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

Initializes a timer using the specified object and selector.