Rafay Hasan Rafay Hasan - 1 year ago 84
iOS Question

Delete a tableview cell by tapping the red minus icon in iOS

I want to delete the tableview cell right away without the confirmation of red "Delete" button press when user clicks the red minus icon.
Steps 1. Hit edit button > red minus icon appears > hit the minus icon >> row deleted without showing the red "Delete" icon.

Answer Source

This does the work you want.

- (nullable NSString *)tableView:(UITableView *)tableViews titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath 
[arrOutputRecords removeObjectAtIndex:indexPath.row];

[tableViews deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]

[_tableView reloadData];

return @"";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download