If you look at the UITableViewDelegate documentation , you will see that there are five ways to customize the editing behavior. There is also a method
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
in the UITableViewDataSource documentation , which will be called in each cell before you go into edit mode. The same is true for
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
which will be called for all editable cells. If you want to change the way you view cells, you can do this in any of them. (Without implementing canEditRow..
, it is assumed that all lines are editable.)
Also note that there may be other ways to enter edit mode, such as scrolling through a cell, in which case
- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
will be called for the cell you clicked on:
When you enter this edit mode, "swipe the screen" in the table view, the message tableView: willBeginEditingRowAtIndexPath: is sent to the delegate so that he can customize his user interface.
source share