4
votes

On my iphone app, I have a UITableView in edit mode, containing custom UITableViewCell. I would like to detect when user has clicked on the left button of each cell (minus circular red button, the one that is animated with a rotation), just before the "Delete" button appears.

I would like to be able to change my cell content in that case...

Is that possible ?

Thanks !

2

2 Answers

8
votes

You can subclass UITableViewCell that implements -willTransitionToState: and/or -didTransitionToState: methods.

willTransitionToState: Subclasses of UITableViewCell can implement this method to animate additional changes to a cell when it is changing state. UITableViewCell calls this method whenever a cell transitions between states, such as from a normal state (the default) to editing mode. The custom cell can set up and position any new views that appear with the new state. The cell then receives a layoutSubviews message (UIView) in which it can position these new views in their final locations for the new state. Subclasses must always call super when overriding this method.

3
votes
- (void)setEditing:(BOOL)editing animated:(BOOL)animate
{
    [super setEditing:editing animated:animate];

    if(editing)
    {
        NSLog(@"editMode on");
    }
    else
    {
        NSLog(@"editMode off");
    }
}