开发者

Will timerWithTimeInterval:target:selector:userInfo:repeats: fire immediately or will it fire first time after the specified time interval?

开发者 https://www.devze.com 2022-12-07 23:41 出处:网络
The documentation says about timerWithTimeInterval:target:selector:userInfo:repeats: Returns a n开发者_如何学Cew NSTimer that, when added

The documentation says about timerWithTimeInterval:target:selector:userInfo:repeats:

Returns a n开发者_如何学Cew NSTimer that, when added to a run loop, will fire after a specified number of seconds.

I don't fully understand this. Maybe someone can tell if it fires immediately or if the first time the selector gets called would be after the specified time interval (i.e. 10 seconds)?


It will fire in the given timeInterval, so not immediately. And when you set repeats to NO, it will not fire itself again, otherwise, it will send the first message after timeInterval seconds, then every timeInterval seconds.

0

精彩评论

暂无评论...
验证码 换一张
取 消