I have a question regarding editing a UITableView. I want to know how to hide a subview when the deletion control is tapped and the the delete button appears. I’ve figured out how to hide the subview when the delete button is tapped, but that is too late. I used the following code to accomplish that:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
exerciseDate = (UILabel *)[cell viewWithTag:8989];
exerciseDate.hidden = YES;
As you can see in the screenshots below, the text ‘Today’ and ‘Yesterday’ is the subview of each cell. I want to hide this subview when the deletion control (the red round button to the left) is tapped and the delete button appears (screen shot 2). Do I need to set up a listener for the deletion control? If so, how would I do that?
Thank you in advance!


There’s the answer to your question, and then there’s what I think you really want to do but don’t know it.
What you asked for: Subclass
UITableViewCelland use the new one. Implement this on the class:What I would suggest you do though is the following:
If you created the cell in
InterfaceBuilder(or Xcode4’s version thereof), change thelabelon the right’s resizing behavior. You want it anchored to the right (default is left). Then when the cellresizesthe content to fit the default button on there, it will push the"Today"label over to the left.