iOS7 Tableview Delete Row Best Practice
ios, row, tableview
Solution
Removing a row from storyboard is pretty straightforward. You just have to inherit 2 methods in your TableView Data source. First is telling if a row can be deleted:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
Second is removing the row from table view:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
}
Problem
On the iPhone there is a text book example of how to delete a tableview row in the Message Apps. This appears to use three separate views to perform the task. My question is about whether there are short cuts to achieve this or do you just create three screens and to do the bleedin' obvious. Many thanks.