• 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: Initializing an Array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Initializing an Array


  • Subject: Re: Initializing an Array
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 21 Jan 2002 14:45:33 -0800

On Monday, January 21, 2002, at 02:18 PM, Michael P. Rogers wrote:

Is it possible to initialize an instance variable array in Objective-C? PB doesn't like it when I attempt to do so in the interface section, i.e., code like this fails:

NSString * sayings[2] = {@"Do unto",@"others"};

Try

NSArray *myArray = [[NSArray arrayWithObjects:@"Do unto",@"others", nil] retain];

in your +initialize method instead.

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Software Engineer, Cocoa Evangelism
Apple Worldwide Developer Relations


  • Follow-Ups:
    • Re: Initializing an Array
      • From: Andy <email@hidden>
References: 
 >Initializing an Array (From: "Michael P. Rogers" <email@hidden>)

  • Prev by Date: Re: NSGlyph is still a puzzle
  • Next by Date: Re: NSBrowser clearing (pt.2)
  • Previous by thread: Initializing an Array
  • Next by thread: Re: Initializing an Array
  • Index(es):
    • Date
    • Thread