Initializer

init(timeInterval:invocation:repeats:)

Initializes a timer object with the specified invocation object. あるタイマーオブジェクトをこの指定された発動オブジェクトで初期化します。

Declaration 宣言

init(timeInterval ti: TimeInterval, 
invocation: NSInvocation, 
repeats yesOrNo: Bool)

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.0001 seconds instead. タイマーの発火それらの間の秒数。ti0.0より少ないまたは等しいならば、このメソッドは代わりに0.0001秒の非負の値を選びます。

invocation

The invocation to use when the timer fires. The timer instructs the invocation object to maintain a strong reference to its arguments. タイマーが発火する時に使うことになる発動。タイマーは、発動オブジェクトにそれの引数への強い参照を保守するように命じます。

repeats

If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires. trueならば、タイマーは、無効にされるまで繰り返しそれ自身を予定します。falseならば、タイマーはそれが発火した後に無効にされます。

Return Value 戻り値

A new NSTimer object, configured according to the specified parameters. ある新しいNSTimerオブジェクト、それは指定されたパラメータによって構成設定されます。

Discussion 議論

You must add the new timer to a run loop, using add(_:forMode:). Then, after ti have elapsed, the timer fires, invoking invocation. (If the timer is configured to repeat, there is no need to subsequently re-add the timer to the run loop.) あなたは、この新しいタイマーを実行ループに、add(_:forMode:)を使って加えなければなりません。それから、tiが経過した後に、タイマーは発火して、invocationを発動します。(タイマーが繰り返すように構成設定されるならば、続けてタイマーを実行ループへと再度追加する必要はありません。)

See Also 参照

Creating a Timer タイマーを作成する