eric.mitchell eric.mitchell - 1 month ago 14
iOS Question

Reverting UITableViewCell to normal editing mode

I have a second confirmation dialog that appears when a user decides to delete a UITableViewCell. Here is my table view in its normal state:

Normal




And here it is when the whole table goes into editing mode:

Normal editing mode




Now when the user taps one of the red minus signs on the left, the cell goes into delete confirmation mode:

Delete confirmation mode




If the user then taps the delete button that has just appeared, this action sheet appears:

Second confirmation




This is where the problem arises. If the user confirms that they want to delete the map, all is well. But if the cancel button is pressed, the action sheet disappears, but the table view still looks like this:

The delete confirmation button should no longer be in its selected state, and should have hidden itself from view

The issue is that the delete confirmation button should no longer be in its selected state, and should have hidden itself from view. As you can see it hasn't. My searches in the documentation have ended with no results. I don't want to
setEditing:NO
because I want the table to remain in its normal editing state. Any ideas?

Edit 1: Here is what goes on inside
tableView:commitEditingStyle:forRowAtIndexPath:


- (void)tableView:(UITableView*)tableView commitEditingStyle:
(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath {
NSInteger finalIndex = [self getFinalIndexForIndexPath:indexPath];

NSString* mapTitle = ((PreviewDataObject*)[[[SingletonDataController sharedSingleton]
getImportedOrSavedMapPreviews:masterIdentifierString]
objectAtIndex:finalIndex]).titleString;

UIActionSheetWithIndexPath* sheet = [[UIActionSheetWithIndexPath alloc] initWithTitle:
[NSString stringWithFormat:@"Are you sure you want to delete the map '%@'?",
mapTitle] delegate:self cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete Map" otherButtonTitles:nil];
sheet.indexPath = indexPath;
[sheet showFromTabBar:[AppDelegate appDelegate].tabBarController.tabBar];
[sheet release];
}

Answer

After that, you may as well present an AlertView asking if they really, really, really want to delete.

The 2-step process of turning on the button and then pressing delete should be plenty of confirmation.

Doing what you're doing does not seem to me to be standard practice, and once you get into that area you're going to find holes in the framework.