UITableViewCellEditingStyleInsert添加按钮不起作用

时间:2013-09-12 23:33:06

标签: ios uitableview

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

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

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

1 个答案:

答案 0 :(得分:1)

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleInsert)
    {
        NSLog(@"UITableViewCellEditingStyleInsert");
        //Perform relevant task here
    }
}
相关问题