NSTimer
An NSTimer object calls a selected method every so many seconds if the repeat factor is set to YES. Otherwise it calls the selected method once if the repeat factor is set to NO.
Example
NSTimer *myTimer = [NSTimer
scheduledTimerWithTimeInterval:1.5f
target:self
selector: @selector(handleTimer:)
userInfo: nil
repeats: YES];
// now you must write the method
// that you declared in the
// @selector statement (handleTimer:)
- (void) handleTimer:(NSTimer *) mytimer
{
// do whatever you want to do here
// this method will be executed
// every 1.5 seconds
}
// to stop a timer
[myTimer invalidate];
myTimer = nil;