Skip to content

Instantly share code, notes, and snippets.

@donly
Created May 24, 2012 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donly/2779217 to your computer and use it in GitHub Desktop.
Save donly/2779217 to your computer and use it in GitHub Desktop.
// declcare
@property (assign) NSTimer *repeatingTimer;
// implements
- (IBAction)startRepeatingTimer:sender {
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.5
target:self selector:@selector(timerFireMethod:)
userInfo:[self userInfo] repeats:YES];
self.repeatingTimer = timer;
}
- (IBAction)stopRepeatingTimer:sender {
[repeatingTimer invalidate];
self.repeatingTimer = nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment