Posted By

magickaito on 04/15/11


Tagged


Versions (?)

ObjectiveC NSTimer


 / Published in: Objective C
 

  1. .h file
  2.  
  3. // declare timer
  4.  
  5. NSTimer *countDownTimer;
  6. @property (nonatomic, retain) NSTimer *countDownTimer;
  7.  
  8. .m file
  9.  
  10. // stop the timer before it is used
  11. // this is useful sometimes if not the timer might be run twice
  12. [self.countDownTimer invalidate];
  13.  
  14. // this will create and RUN/SCHEDULE the timer all at the same time.
  15. self.countDownTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(callBackFunctionHere:) userInfo:nil repeats:NO];

Report this snippet  

You need to login to post a comment.