scheduledTimer(timeInterval:target:selector:userInfo:repeats:)
Creates a timer and schedules it on the current run loop in the default mode.
Declaration
class func scheduledTimer(timeInterval ti: TimeInterval, target aTarget: Any, selector aSelector: Selector, userInfo: Any?, repeats yesOrNo: Bool) -> TimerParameters
- ti:
The number of seconds between firings of the timer. If
tiis less than or equal to0.0, this method chooses the nonnegative value of0.0001seconds instead. - aTarget:
The object to which to send the message specified by
aSelectorwhen the timer fires. The timer maintains a strong reference totargetuntil it (the timer) is invalidated. - aSelector:
The message to send to
targetwhen 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. - yesOrNo:
If True, the timer will repeatedly reschedule itself until invalidated. If False, 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
scheduledTimer(withTimeInterval:repeats:block:)scheduledTimer(timeInterval:invocation:repeats:)init(timeInterval:repeats:block:)init(timeInterval:target:selector:userInfo:repeats:)init(timeInterval:invocation:repeats:)init(fire:interval:repeats:block:)init(fireAt:interval:target:selector:userInfo:repeats:)