iPhone SDK Tips & Tricks
-(void)startTimer {
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timerFire:) userInfo:nil repeats:YES]; //Don't forget the colon after timerFire if it has an argument!! } -(void)timerFire:(NSTimer*)theTimer { //Do timer stuff here if (shouldKillTimer) [theTimer invalidate]; }
OR
[self performSelector:@selector(timerFunction) withObject:nil afterDelay:timeInSeconds];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(timerfunction) object:nil];