Ios 从UITableViewCell中的多个附件按钮确定发送者?

Ios 从UITableViewCell中的多个附件按钮确定发送者?,ios,uitableview,Ios,Uitableview,现在我有一个自定义UITableView单元格,其中包含2个附件按钮 当点击其中一个按钮时,它会触发: (void) shareButtonTapped:(UIControl *)button withEvent:(UIEvent *) event { NSIndexPath * indexPath = [self.tableview indexPathForRowAtPoint:[[[event touchesForView: button] anyObject] locationInV

现在我有一个自定义UITableView单元格,其中包含2个附件按钮

当点击其中一个按钮时,它会触发:

(void) shareButtonTapped:(UIControl *)button withEvent:(UIEvent *) event
{
   NSIndexPath * indexPath = [self.tableview indexPathForRowAtPoint:[[[event touchesForView: button] anyObject] locationInView: self.tableview]];
    if ( indexPath == nil )
        return;

    [self.tableview.delegate tableView:self.tableview accessoryButtonTappedForRowWithIndexPath:indexPath];
}

然后,我使用以下方法来处理触摸事件

(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

        NSLog(@"Accessory tapped for row %d", indexPath.row);
}

我的问题:在“accessoryButtonTappedForRowWithIndexPath”中,我如何确定在UITableViewCell中按下了两个按钮中的哪一个?我希望以不同的方式处理每个触摸。

正如Mariam指出的,我使用自己的自定义方法来接收调用,而不是内置的accessoryBUttonTappedForRowWithIndexPath方法。

为什么最终要调用accessoryBUttonTappedForRowWithIndexPath,为什么不调用您的自定义方法呢?我认为这是最佳实践……假设这就是UITableViewCells中按钮的处理方式。我说的不对吗?据我所知,我需要按下按钮的索引以及按下按钮的类型,因为您没有使用附件按钮,所以不需要调用此方法。您可以实现自己的事件处理程序方法。如果它显示在每一行(即每个UITableViewCell)上,是否会被视为附件按钮。我会尝试调用我自己的方法不,这不是一个附件按钮,附件按钮是当你设置tableViewCell的属性时,你不能在同一个单元格上有2个。
(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

        NSLog(@"Accessory tapped for row %d", indexPath.row);
}