Tuesday, September 21, 2010

Reading a plist into an NSArray

Instead of hard coding elements into an array with string literals, such as in the following example:

NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:@"Eenie", @"Meanie", @"Minee", @"Moe", nil];

it is better (and always a good practice) to populate the elements for the array with values read in from a configuration file. In the case of populating values in an object (such as string values in a UIPickerView object when developing apps for the iPhone/iPod Touch), you can read in values from a property list (or .plist).

Rather than reinventing the wheel, I will point you to an existing quick and easy tutorial on how to read a plist into an NSArray, which I found over at iphonedevelopertips.com. I found it very useful myself:

Link to "Reading a plist into an NSArray"

First Post!

Welcome all!

This blog was created to help you with everyday tech issues in the field of code development, IT configuration, troubleshooting, debugging, tutorials and whatever the heck else I please.

Please feel to drop me and email at leon [dot] peon [at] gmail [dot] com