我正在解析我的 json 文件并将其显示在分组表视图中。
-(void) connectionDidFinishLoading:(NSURLConnection *)connection
{
NSDictionary *allDataDictionary = [NSJSONSerialization JSONObjectWithData:webData options:0 error:nil];
NSDictionary *parks = [allDataDictionary objectForKey:@"Parks"];
NSArray *arrayOfParks = [parks objectForKey:@"Park"];
for (NSDictionary *diction in arrayOfParks) {
NSString *hebName = [diction objectForKey:@"hebName"];
NSString *engName = [diction objectForKey:@"engName"];
NSString *latitude = [diction objectForKey:@"lat"];
NSString *longtitude = [diction objectForKey:@"long"];
[array addObject:hebName];
}
[[self myTableView] reloadData];
}
-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *details = [array objectAtIndex:indexPath.row];
[[[UIAlertView alloc] initWithTitle:@"B7Tour" message:details delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
}
它工作得很好,我在我的表格视图中展示了engName
. 单击表视图中的项目将弹出一个带有 engName 的警报itself
。
我的问题是:如何提取特定的latitude
并longtitude
保存它们?我知道如何在表格视图中显示它们,但我想提取并保存它们以供额外使用。
有任何想法吗?