0

我想在按下带有 style 的 UITableView 单元格的添加按钮后调用一个方法UITableViewCellEditingStyleInsert。我一直在使用tableView:didSelectRowAtIndexPath:,但我刚刚意识到这种方法仅在按下单元格“body”时有效,而不是按钮。

我试过使用tableView:accessoryButtonTappedForRowWithIndexPath:,但这种方法似乎只适用于 UITableViewCell 配件。

任何帮助将不胜感激。谢谢。

4

1 回答 1

1
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleInsert)
    {
        NSLog(@"UITableViewCellEditingStyleInsert");
        //Perform relevant task here
    }
}
于 2013-09-18T02:11:38.803 回答