私のアプリが起動したときにメソッドを呼び出し、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