• 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: NSTimer and a problem with document-based apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer and a problem with document-based apps


  • Subject: Re: NSTimer and a problem with document-based apps
  • From: "Sumner Trammell" <email@hidden>
  • Date: Mon, 28 Jul 2008 13:57:07 -0400

Thanks guys. Using class methods was a brilliant idea. Solidified my
understanding of when I might want to use them, and when I might want
to use @synchronized as well.


-s

On Sat, Jul 26, 2008 at 7:30 PM, Todd Heberlein <email@hidden> wrote:
>> - (id)init {
>> ...
>> timer = [NSTimer scheduledTimerWithTimeInterval:10.0
>> ...
>> }
>
> ...
>>
>> That new instance of course calls init, and suddenly I have two NSTimers
>> running when I only wanted one timer for the whole app.
>
> I think you want to make your timer a global variable and then initialize it
> within a call to a +load or +initialize method for one of your classes. See
> the following link:
>
> http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/Executing-code-before-main.html
>
> Todd
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSTimer and a problem with document-based apps (From: "Sumner Trammell" <email@hidden>)
 >Re: NSTimer and a problem with document-based apps (From: Todd Heberlein <email@hidden>)

  • Prev by Date: Re: Getting process table info from within a Cocoa app
  • Next by Date: How would you tell WebKit to keep all JavaScript popup windows on top/in front?
  • Previous by thread: Re: NSTimer and a problem with document-based apps
  • Next by thread: CGDisplayBounds vs NSSCreen visibleFrame
  • Index(es):
    • Date
    • Thread