• 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 Constants
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class Constants


  • Subject: Re: Class Constants
  • From: Greg Hulands <email@hidden>
  • Date: Mon, 31 May 2004 10:44:06 +1000

static NSDictionary *attributes = nil;

in the method that you need it.

if (!attributes)
{
attributes = [[NSDictionary dictionaryWithContentsOfFile:someFile] retain];
}
return attributes;

On 31/05/2004, at 9:57 AM, James Stroud wrote:

Hello All,

I would like to make a NSDictionary filled with the same values available to all instances of a class. (It would not change from instance to instance, but all instances will need it. I want to read this dictionary in from a plist, but I think it would be wasteful for each instance to have its own copy of the dictionary. Its not obvious to me how I would go about implementing this. Does anyone have any advice.

Thanks in advance,

James

---------------------------------------------------------
James Stroud
Department of Chemistry
University of Colorado
Boulder, CO 80309-0215, USA

tel: 303-492-4503
www: http://JamesStroud.com/
--------------------------------------------------------
_______________________________________________
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.
_______________________________________________
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.


References: 
 >Class Constants (From: James Stroud <email@hidden>)

  • Prev by Date: Using NSThread (was: console output -> NSTextView)
  • Next by Date: Re: Class Constants
  • Previous by thread: Class Constants
  • Next by thread: Re: Class Constants
  • Index(es):
    • Date
    • Thread