O'Reilly logo

The Complete Idiot's Guide® To iPad and iPhone App Development by Troy Brant

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Collections

The iPhone OS offers two collection classes you will use often in your applications: NSArray and NSDictionary.

NSArray

NSArray is a class provided by the Foundation framework that manages a flat ordered collection of objects. You are likely familiar with arrays in other languages, and NSArrays work in much the same way.
The easiest way to understand collections is to see them in action. Here is a quick sample, showing you how to initialize and iterate through an NSArray:
190
Some important notes about the preceding code:
• The syntax for arrayWithObjects: has an important detail. As you can see, you specify the objects you want in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required