Possible Duplicate:
change Table to Edit mode and delete Rows inside a normal ViewController
I want to delete selected row from tableView. I want to provide the functionality to the user to delete the row when he slips or flicks his finger on the row. I know the editing style which provides a circular red button with -ve sign on it.
I have tried this code:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView beginUpdates];
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Do whatever data deletion you need to do...
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationTop];
}
[tableView endUpdates];
[tableView reloadData];
}
I get the delete button but when I click it SIGABRT Error is there.