- (void)viewDidLoad
{
[superviewDidLoad];
NSString *path = [[NSBundlemainBundle] pathForResource:@"locations"ofType:@"plist"]; //plist檔案名稱、附檔名
NSData *plistData = [NSData dataWithContentsOfFile:path];
NSString *error; NSPropertyListFormat format;
NSArray *allspots = [NSPropertyListSerializationpropertyListFromData:plistData
mutabilityOption:kCFPropertyListMutableContainersAndLeaves
format:&format
errorDescription:&error];
NSString *documentsPath = [[allspots objectAtIndex:0] objectForKey:@"stitle"]; //先取第一個item, 在找key名稱為"stitle"
NSLog(@"Get: %@", documentsPath); //秀出該筆item的stitle的值
}
請先 登入 以發表留言。