- (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的值


}

創作者介紹
創作者 我是艾娃小姐 的頭像
艾娃小姐

我是艾娃小姐

艾娃小姐 發表在 痞客邦 留言(0) 人氣( 152 )