Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In UITableViewCell how can I revert the delete confirmation mode back to normal editing mode?

I have a custom confirmation alert dialog box on top of the regular cell deletion confirmation for some cells, it's sort of doing a double confirmation for these cells. (This is after user enters editing mode, not by swipe) So, if the user clicks 'OK' to confirm in my custom confirmation dialog. It's supposed to do the actual deletion, which behaves well since the whole cell will be removed from the TableView. However, if the user clicks 'Cancel' The cell does not get deleted it remains in the table and remain in "Cancellation Confirmation Mode". This is not what I want, I want it to be reverted back to the 'Normal cell editing mode". I've searched through apple documentation, it only provides a "showingDeleteConfirmation" readonly method. It doesn't really have a way to revert this mode back to cell editing. I can do this to hack it:

        [cell setEditing:NO animated:NO];
        [cell setEditing:YES animated:NO];

I can't enable animation here because it will look bad it's temping to go back to non-editing mode to editing mode again. But the animation transition is not quite smooth without it. IS THERE ANY CLEANER WAY TO DO THIS?

like image 916
Jeremy Lu Avatar asked Jun 16 '11 16:06

Jeremy Lu


1 Answers

for anyone else still looking for this, this does a smooth, opposite transition for a single cell:

[tableView setEditing:FALSE animated:TRUE];
like image 94
mitrenegade Avatar answered Sep 21 '22 14:09

mitrenegade