• 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: class keeps track of object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: class keeps track of object


  • Subject: Re: class keeps track of object
  • From: "Shripada Hebbar" <email@hidden>
  • Date: Wed, 02 Jul 2008 10:32:37 +0530

Daniel

You are trying to create a singleton object in cocoa and there is a good documentation on this at:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_10.html


-Shripada
>
> Thanks! Exactly what I was looking for.
>
> Daniel
>
>
> Jonathan Hess wrote:
> > Han Daniel -
> >
> > You can use a global variable just like you would in C:
> >
> >     static Foo *bar = nil;
> >
> >     @implementation Foo
> >     + (id)bar {
> >         if (!bar) {
> >             bar = [[Foo alloc] init];
> >         }
> >         return bar;
> >     }
> >     @end
> >
> >
> > Thats the simple single threaded case. Things get much more
> > interesting if you want to be able to call 'bar' from multiple threads.
> >
> > Compiled in Mail -
> > Jon Hess



-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.


_______________________________________________

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

  • Prev by Date: Re: exec(uting) Safari - How (newbie)
  • Next by Date: Re: Getting mouse moved events on overlay windows
  • Previous by thread: Re: class keeps track of object
  • Next by thread: Re: Getting mouse moved events on overlay windows
  • Index(es):
    • Date
    • Thread