NSDictionary によって取り込まれているテーブルビュー (マスター/詳細) があります。masterview にはすべてのキーのリストが表示されますが、detailview (これも可能です) に値を表示させたいと思います。たとえば、マスター テーブルのキー 1 には、詳細ビューに表示したいいくつかの値があります。
これは私のテーブルビューです
-
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell==nil)
{
cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSString *key = [myKeyArray objectAtIndex:indexPath.row];
NSDictionary *myDictionary = [MyDictionaryArray objectForKey:key];
cell.textLabel.text=key;
cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
}
return cell
//this gives me a list of all keys which is fine
}
-(void)tableView:(UITableView *)tableview didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TableViewController *dvc=[[TableViewController alloc] init];
//this is where I am stuck, I want the details to be pushed to the next tableview
[self.navigationController pushViewController:dvc animated:YES ];
}