• 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: NSArray as a static
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray as a static


  • Subject: Re: NSArray as a static
  • From: Graham Cox <email@hidden>
  • Date: Tue, 2 Sep 2008 10:28:45 +1000


On 2 Sep 2008, at 6:47 am, Richard Good wrote:

So let me rephrase the question How do I create an array of constant strings such that I have only one instance for the entire class,
or is that just not possible. If its not possible how do you approach the problem in Objective C.

for example:


+ (NSArray*) myListOfStringConstants { static NSArray* constants = nil;

if( constants == nil )
constants = [[NSArray arrayWithObjects:@"constant1", @"constant2", @"constant3", nil] retain];


    return constants;
}



hth,

Graham
_______________________________________________

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


  • Follow-Ups:
    • Re: NSArray as a static
      • From: Richard Good <email@hidden>
References: 
 >NSArray as a static (From: Richard Good <email@hidden>)
 >Re: NSArray as a static (From: "Kyle Sluder" <email@hidden>)
 >Re: NSArray as a static (From: Richard Good <email@hidden>)

  • Prev by Date: HFS Path To POSIX Path
  • Next by Date: Re: HFS Path To POSIX Path
  • Previous by thread: Re: NSArray as a static
  • Next by thread: Re: NSArray as a static
  • Index(es):
    • Date
    • Thread