附件Tapped不在UITableView中触发segue

时间:2013-06-08 14:42:10

标签: ios uitableview

我有一个静态单元格的tableview。我正在使用cellForRowAtIndexPath:来创建我的单元格。其中一个具有以编程方式添加到其中的公开附件指示器。它的各自方法是这样的:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
     NSLog(@"aBTFRAIP:accessory tapped");
}

但是控制台中没有日志。当我点击单元格时,didSelectRowAtIndexPath:方法将触发该单元格。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

accessoryButtonTappedForRowWithIndexPath:方法适用于详细信息显示按钮(蓝色按钮),并且仅在点按按钮本身时,而不是点击单元格。

如果您点按小区didSelectRowAtIndexPath:会被解雇,而 accessoryButtonTappedForRowWithIndexPath:就像您想要的那样。

相关问题