Welcome! I just worked all night on this, but not a banana; perhaps you have an understanding!
I work with standard NSMutableArray:
self.itemTable = [[NSMutableArray alloc]
initWithObjects:@"House.",
@"Car.",
@"Keys.", nil];
Now when I click "EDIT" in the navigation bar and delete the line, I get the following error message
The application terminated due to the uncaught exception "NSInternalInconsistencyException", reason: "Invalid update: invalid number of lines in section 0. The number of lines contained in an existing section after updating (3) must be equal to the number of lines contained in this section before updating (3 ), plus or minus the number of inserted or deleted rows from this section (inserted 0, 1 deleted) and plus or minus the number of rows moved to or from this section (0 moved, 0 deleted).
I use this code for the delete command:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
Any info on how to make the delete line function work?
EDIT :
Found: placing the following line of code in the processed file:
[self.itemTable removeObjectAtIndex:indexPath.row]
What the removal code does:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[self.itemTable removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}