我需要在我的应用程序启动时调用方法,然后每5秒调用一次相同的方法。如何立即触发NSTimer?
我的代码非常简单:
// Call the method right away
[self updatestuff:nil]
// Set up a timer so the method is called every 5 seconds
timer = [NSTimer scheduledTimerWithTimeInterval: 5
target: self
selector: @selector(updatestuff:)
userInfo: nil
repeats: YES];
是否有定时器所以它的触发马上,然后每隔5秒的选项?
很不错的语法! – loretoparisi