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
する方法です。テーブルビューでそれらを表示する方法を知っていますが、追加の使用のためにそれらを抽出して保存したいと思います。
何か案は?