Re: What to do with a NSTimer that has been invalidated ?
Re: What to do with a NSTimer that has been invalidated ?
- Subject: Re: What to do with a NSTimer that has been invalidated ?
- From: Ian Gillespie <email@hidden>
- Date: Mon, 7 Apr 2003 11:34:23 -0700
I'm looking for a way to stop and later resume a NSTimer that fires
periodically.
If I call [timer invalidate], how can I "validate" it again ?
I don't think you can. Invalidating a timer makes it so it can never
fire again.
What you can do instead is set its fire date to [NSDate distantFuture]
to "invalidate" the timer, and then set its fire date to "now" (or now
plus its repeat interval) to "reactivate" it.
I've done this, and it works well.
Would it also work to re-create the timer? I don't know, but I am
curious.
[timer invalidate];
timer = [NSTimer scheduledTimer...];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.