Hi,
I found many threads about edit and delete within an tableview.
Still I can not figure it out.
If i excute the code below it stucks at "[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];" and crashes with the
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (3), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted).'
Code:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
notificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
notif = [notificationArray objectAtIndex:indexPath.row];
[notificationArray removeObjectAtIndex:indexPath.row];
[self.tableview reloadData];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
}
Thanks