• 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: really basic nsarray intialization question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: really basic nsarray intialization question


  • Subject: Re: really basic nsarray intialization question
  • From: Shawn Erickson <email@hidden>
  • Date: Sat, 12 Jul 2003 12:40:35 -0700

On Saturday, July 12, 2003, at 12:08 PM, Michael Hanna wrote:

how do initialize an NSArray with a series of string literals? I've seen it somewhere in documentation, but for the life of me I can't find it.

Strings (NSString or @"...") are objects, so use either arrayWithObjects or initWithObjects, etc.

For example...
NSArray* array;
array = [NSArray arrayWithObjects: @"first", @"second", @"third", nil];

Read over http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSArray.html#//apple_ref/occ/cl/NSArray.

-Shawn
_______________________________________________
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.

  • Follow-Ups:
    • getCString a good idea here?
      • From: Michael Hanna <email@hidden>
References: 
 >really basic nsarray intialization question (From: Michael Hanna <email@hidden>)

  • Prev by Date: Re: really basic nsarray intialization question
  • Next by Date: getCString a good idea here?
  • Previous by thread: Re: really basic nsarray intialization question
  • Next by thread: getCString a good idea here?
  • Index(es):
    • Date
    • Thread