AveLeon
AveLeon

Reputation: 203

UITableViewCellEditingStyleInsert add button not working

I would like to call a method after pressing the add button of a UITableView cell with style UITableViewCellEditingStyleInsert. I have been using tableView:didSelectRowAtIndexPath: but I just realized that this method only works when the cell "body" is pressed, not the button.

I have tried using tableView:accessoryButtonTappedForRowWithIndexPath: but this method seems to work only for UITableViewCell accessories.

Any help will be appreciated. Thanks.

Upvotes: 0

Views: 1408

Answers (1)

AveLeon
AveLeon

Reputation: 203

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

Upvotes: 1

Related Questions