Posted By

funkypanda on 12/02/09


timer Task NSTimer

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Start and Stop NSTimer to perform a task

 / Published in: Objective C

  1. // Create a timer that call taskToUpdate every 1.0 sec
  2. NSTimer timer = [NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(taskToUpdate) userInfo:nil repeats:YES];
  5. // Stop the timer if it's running
  6. // (no way to "stop it" and "run it back", you must "kill it" and "recreate it")
  7. if([timer isValid]){
  8. [timer invalidate];
  9. timerAffcheur = nil;
  10. }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: paki on May 11, 2011

You're missing a * before timer.. So it should be NSTimer *timer = ...

Posted By: on September 17, 2018

unlock samsung cell phone codes unlockmobiledevice

You need to login to post a comment.