Re: NSArray as a static
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