【发布时间】:2012-03-21 10:22:37
【问题描述】:
我在 .xib 的自定义单元格中的三列结构中有三个按钮
看图:
我还有两个类,一个包含列表,第二个包含单元格我设法注销了属于该单元格的类中按钮的触摸,但我也想知道他们是否触摸我想让 didSelectRowAtIndexPath 触发的 firstColumnButton。
我的最终目标是触发 didSelectRowAtIndexPath,找出哪个单元格已被按下,该单元格中的哪个按钮,以便用户可以转到他们按下的正确内容。
在 ListController.m 中:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Pressed on the table");
if(cell.pressedButtonInColumnOne == YES){
NSLog(@"Pressed button one in column one");
}
}
现在第一个 NSLog 根本没有触发。
CategoryCell.m 中只有这个
- (IBAction)pressedFirstColumnButton:(id)sender {
NSLog(@"pressed first button in category cell");
}
如果我在 IB 中将按钮向上移动,则表格会做出反应,但按钮不会被按下。
【问题讨论】:
标签: objective-c ios ipad ios4