I want to call a certain method in my UIView code say every 5 minutes - how do I accomplish that?
You can use an NSTimer:
Put the following in your viewDidLoad (where 300 is the number of seconds):
[NSTimer scheduledTimerWithTimeInterval:300.0f
target:self
selector:@selector(updateMethod:)
userInfo:nil
repeats:YES];
And then create your update method:
- (void)updateMethod:(NSTimer *)theTimer {
// Your code goes here
}
You can use NSTimer to do this.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html
Specifically, the
timerWithTimeInterval:target:selector:userInfo:repeats:
class method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With