UITableView : detecting click on '-' button in edit mode

后端 未结 2 1551
无人共我
无人共我 2020-12-19 17:32

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 c

相关标签:
2条回答
  • 2020-12-19 17:47

    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.

    0 讨论(0)
  • 2020-12-19 17:52
    - (void)setEditing:(BOOL)editing animated:(BOOL)animate
    {
        [super setEditing:editing animated:animate];
    
        if(editing)
        {
            NSLog(@"editMode on");
        }
        else
        {
            NSLog(@"editMode off");
        }
    }
    
    0 讨论(0)
提交回复
热议问题