Tôi cần gọi phương thức khi ứng dụng của tôi bắt đầu và sau đó gọi cùng một phương thức cứ sau 5 giây.Làm thế nào để kích hoạt NSTimer ngay lập tức?
Mã của tôi là khá đơn giản:
// 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];
Có một lựa chọn cho bộ đếm thời gian do đó, nó kích hoạt ngay lập tức và sau đó mỗi 5 giây?
cú pháp Very nice! – loretoparisi