I am new in this field. So, can anyone explain how to use plist programmatically? From, where can I start , so that I can learn it properly?
Asked
Active
Viewed 101 times
-4
-
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/PropertyLists/QuickStartPlist/QuickStartPlist.html – Andrey Chernukha Mar 03 '15 at 10:47
1 Answers
-1
You can access plist as same as NSDictionary. Plist provide data in key value formate.
-you can add your own plist file and use your plist as this way.
NSString *path = [[NSBundle mainBundle] pathForResource: @"plistname" ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile: path];
NSString *temp = [dict objectForKey:[NSString stringWithFormat:@"%@-Your key name",key]];

Developer
- 65
- 3
-
2Or more concisely: `NSString *value = dict[key];`. There are two errors in your final line of code (3 if you include the fact the outer `stringWithFormat` is unnecessary). – trojanfoe Mar 03 '15 at 10:32