共用方式為


NSTimer.CreateScheduledTimer 方法

定義

多載

CreateScheduledTimer(Double, NSObject, Selector, NSObject, Boolean)

使用指定的參數建立計時器,並將它排程在預設模式的目前 NSRunLoop 上執行。

CreateScheduledTimer(Double, Boolean, Action<NSTimer>)
CreateScheduledTimer(Double, Action<NSTimer>)
CreateScheduledTimer(TimeSpan, Action<NSTimer>)

CreateScheduledTimer(Double, NSObject, Selector, NSObject, Boolean)

使用指定的參數建立計時器,並將它排程在預設模式的目前 NSRunLoop 上執行。

[Foundation.Export("scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:")]
public static Foundation.NSTimer CreateScheduledTimer (double seconds, Foundation.NSObject target, ObjCRuntime.Selector selector, Foundation.NSObject userInfo, bool repeats);
static member CreateScheduledTimer : double * Foundation.NSObject * ObjCRuntime.Selector * Foundation.NSObject * bool -> Foundation.NSTimer

參數

seconds
Double

計時器引發之間的秒數。

target
NSObject

物件,會在計時器引發時叫用。

selector
Selector

在 上 target 叫用的方法。

userInfo
NSObject

計時器的自訂使用者資訊。

這個參數可以是 null

repeats
Boolean

這個計時器是否應該自動重複 (true) ,或在第一次引發 (false) 之後失效。

傳回

屬性

適用於

CreateScheduledTimer(Double, Boolean, Action<NSTimer>)

[Foundation.Export("scheduledTimerWithTimeInterval:repeats:block:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 12, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 10, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSTimer CreateScheduledTimer (double interval, bool repeats, Action<Foundation.NSTimer> block);
static member CreateScheduledTimer : double * bool * Action<Foundation.NSTimer> -> Foundation.NSTimer

參數

interval
Double
repeats
Boolean
block
Action<NSTimer>

傳回

屬性

適用於

CreateScheduledTimer(Double, Action<NSTimer>)

public static Foundation.NSTimer CreateScheduledTimer (double seconds, Action<Foundation.NSTimer> action);
static member CreateScheduledTimer : double * Action<Foundation.NSTimer> -> Foundation.NSTimer

參數

seconds
Double
action
Action<NSTimer>

傳回

適用於

CreateScheduledTimer(TimeSpan, Action<NSTimer>)

public static Foundation.NSTimer CreateScheduledTimer (TimeSpan when, Action<Foundation.NSTimer> action);
static member CreateScheduledTimer : TimeSpan * Action<Foundation.NSTimer> -> Foundation.NSTimer

參數

when
TimeSpan
action
Action<NSTimer>

傳回

適用於