2010-08-25 70 views
0

如何传递所述第一的tableview行数据到第二详细视图行iphone:SDK泄露按钮不响应从第一个TableView到第二个细节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; 

}

添加动作,可以在控制台通知模式

但我认为它总是显示相同的细节查看当我触摸第一级表中的任何行时查看

如何使用来自第一级的数据显示新的详细视图?

例如

为了使tableView1.row0.text =详细view.title

,并在标题下显示出其它数据

,如果你需要的代码,我可以把它上传

我老板说这里面不是很大的秘密...

非常感谢

+0

我不知道我完全理解。 你问如何获得'detailViewController'的标题是从您选择一个单元格的文本? – 2010-08-25 05:05:54

+0

是的,这就是我的意思 – 2010-08-25 06:49:09

+0

哦,我想我知道如何使用示例代码做到这一点! 这并不容易,但我认为我可以找出这个问题 ,我读了“初级iPhone 3开发” 第9章第247页〜267 – 2010-08-25 08:35:45

回答

3

问题也许是你的:

- (void)tableView:(UITableView *)tableViewaccessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{ 

应阅读:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{ 
+0

啊哈书!也许你明白了! – 2010-10-11 01:17:28

+0

魔鬼的细节。 :)我来到这里寻找我自己的问题;我的电话并没有触发......幸运的是(或不幸)这个问题已经消失了。 – Marius 2010-10-11 15:43:50

+0

我的问题是,我还没有正确设置的tableView委托。不要忘记把.h文件头中的放进去。 – Groot 2012-12-10 12:04:54

0

好吧,如果你对附件按钮窃听不是显示另一个详细视图

我们需要添加的细节图

首先创建一个“new navigation based application”前的firstView

右键单击类文件夹和选择“add new File”选择一个新的观点,你想显示

前我选择了一个名为“DetailView

不是第一次去新的tableview到DetailView.m去给一个部分和行号

或声明的布局

不是回来FirstView.h

添加#import DetailView

去的firstView。米

发现这个方法- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath

和使用的DetailView子类来创建一个新视图

添加代码这样

DetailView *detailView =[[DetailView alloc]init]; 
detailView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
[self.navigationController pushViewController:detailView animated:YES]; 

你可以添加你想要显示

任何视图
相关问题