ant idea why this code doesn't work?
Code:
-(void)editButtonPressed:(id)sender{
if ([self isEditing]) {
[sender setTitle:@"Edit" forState:UIControlStateNormal];
[self setEditing:NO animated:YES];
}
else {
[sender setTitle:@"Done" forState:UIControlStateNormal];
[self setEditing:YES animated:YES];
}
}
- (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowIndexAtPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
[possesions removeObjectAtIndex:[indexPath row]];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
possesions is the NSMutable array that is the data source
editButtonPressed gets called and the view goes into editing mode but when delete is pressed, nothing happens.
Thanks in advance