我有一个由 NSDictionary 填充的 tableview (master/detail)。masterview 显示所有键的列表,现在,我希望 detailview(也是 atable)显示值。例如主表中的键 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 ];
}