I have a simple grouped uitableview with a nav bar and an “Edit” nav bar item. the Edit button applies only to the first section, and the other sections of the table do totally different things (think iPhone Settings). My problem is with deleting the last cell of this particular section of the table. Whenever the user deletes the last cell, I am removing the “Edit” button from the nav bar (Cause its not applicable anymore…).
So I do this:
- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
.....
if ([section count] == 0) {
self.navigationItem.rightBarButtonItem = nil;
.....
}
.....
}
The problem is that now the other sections are not functional, meaning, I cant click on them anymore and they dont react. I think it’s because I did not click on “Done” on the nav bar cause this one was deleted after deleting the last cell, so I am basically still in “editing mode” (not sure if i am right here..).
In any case, I tried to call setEditing:animated: manually after deleting the last cell, but that doesnt help.
For reference:
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
NSLog(@"****************** entering setEditing:animated");
[super setEditing:editing animated:animated];
[tblSimpleTable setEditing:editing animated:animated];
}
Any help with this would be much appreciated. Thanks!
Have you tried UITableView* method reloadSections:withRowAnimation:
after
?
Works fine on iOS 5. Might be buggy on lower versions.