Example
suggest change1. Static data to be used in the app.
To store static data in a property list:
a) Add a new file
b) Click Property list in Resources
c) Name the property list. This example uses data.plist.
- You can create a plist of Arrays and Dictionaries as:
pathForResource:ofType: returns nil when data.plist is not in the app target, and then dictionaryWithContentsOfFile: returns nil. A property-list dictionary is immutable. The resource name must match the file name, without .plist.
NSDictionary *dictRoot = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"data" ofType:@"plist"]];
NSArray *arrayList = [dictRoot objectForKey:@"Object1"];
for (NSUInteger i = 0; i < [arrayList count]; i++) {
NSDictionary *details = [arrayList objectAtIndex:i];
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents