【发布时间】:2010-08-25 04:59:01
【问题描述】:
如何将第一个 tableview 行数据传递到第二个详细视图行
我用
[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
或
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
在每个单元格中显示披露按钮
可以,我也在里面加了动作
- (void)tableView:(UITableView *)tableViewaccessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
NSLog(@"disclosure button %@ touched",indexPath.row);
}
但是当我触摸披露按钮时,控制台中什么也没有显示
比我添加动作
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// carry Alarm Name text into sub-table-view to look for detail time and text info
NSLog(@"Alarm Name = %@", [alarmName objectAtIndex:indexPath.row]);
NSLog(@"Index Path Raw# = %i", indexPath.row);
// Navigation logic may go here. Create and push another view controller.
AlarmDetailTableViewController *detailViewController = [[AlarmDetailTableViewController alloc] initWithNibName:@"AlarmTableViewController" bundle:[NSBundle mainBundle]];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
detailViewController = nil;
}
可以在控制台模式下通知
但我认为当我触摸一级 TableView 中的任何行时,它总是显示相同的详细视图
如何使用第一级的数据显示新的详细视图?
例如
使tableView1.row0.text = detail view.title
并在标题下显示其他数据
如果你需要代码我可以上传
我的老板说这不是什么大秘密......
非常感谢
【问题讨论】:
-
我不确定我是否完全理解。您是在问如何让
detailViewController的标题成为您选择的单元格中的文本? -
哦,我想我知道如何使用示例代码做到这一点!这并不容易,但我想我可以弄清楚这个问题我从“Beginner Iphone 3 Development”第9章第9章p.247〜267读的书
标签: iphone xcode sdk tableview disclosure