Re: How do I create a NSArray of NSString constants?
Re: How do I create a NSArray of NSString constants?
- Subject: Re: How do I create a NSArray of NSString constants?
- From: Todd Yandell <email@hidden>
- Date: Mon, 27 Jun 2005 11:51:15 -0500
Hi,
The problem it that you're trying to create an NSArray object from
something that it not an object (a C array). This is what's
generating all of the errors. Instead, you should use the
arrayWithObjects: class method to create an initialize an NSArray
object. Here's an example:
NSArray *objects = [NSArray arrayWithObjects:@"String1", @"String2",
@"String3", nil];
The arrayWithObjects: method is different than most methods in Cocoa
in that it takes paremeters separated by a comma rather than by
keywords, and that it takes unlimited paramaters. The final
paramater, "nil", tells NSArray to stop reading in objects, so it's
important to remember to always end the list of arguments passed to
arrayWithObjects: with "nil".
Todd Yandell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden