UITableView: detection of pressing the "-" button in edit mode

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

I would like to be able to change the contents of my cell in this case ...

Is it possible?

Thanks!

+4
source share
2 answers

You can subclass UITableViewCell , which implements the -willTransitionToState: and / or -didTransitionToState: .

willTransitionToState: Subclasses of UITableViewCell can implement this method to animate additional changes to the cell when the state changes. UITableViewCell calls this method whenever a cell switches between states, for example, from a normal state (default) to edit mode. A custom cell can customize and place any new views that appear in a new state. The cell then receives a layoutSubviews (UIView) message in which it can position these new views at its final locations for the new state. A subclass should always call super when overriding this method.

+8
source
 - (void)setEditing:(BOOL)editing animated:(BOOL)animate { [super setEditing:editing animated:animate]; if(editing) { NSLog(@"editMode on"); } else { NSLog(@"editMode off"); } } 
+3
source

Source: https://habr.com/ru/post/1304174/


All Articles