• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What to do with a NSTimer that has been invalidated ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Prev by Date: Re: Launching other (GUI) applications
  • Next by Date: Re: Broken Nib
  • Previous by thread: Re: What to do with a NSTimer that has been invalidated ?
  • Next by thread: Dragging an Image out of an NSTextView
  • Index(es):
    • Date
    • Thread