Swipe to delete vs. edit button tapped on iPhone

If you implement tableView:willBeginEditingRowAtIndexPath: and tableView:didEndEditingRowAtIndexPath:, the behavior of the method calls will change...

It will no longer call setEditing:animated:, you must handle all editing change logic inside the above two methods. As a side effect of this, self.editing will no longer be YES when a swipe gesture is invoked. This is because the setEditing:animated: is responsible for setting self.editing = YES.


Use the UITableViewDelegate method tableView:willBeginEditingRowAtIndexPath:. From the documentation:

This method is called when the user swipes horizontally across a row; as a consequence, the table view sets its editing property to YES (thereby entering editing mode) and displays a Delete button in the row identified by indexPath. In this "swipe to delete" mode the table view does not display any insertion, deletion, and reordering controls. This method gives the delegate an opportunity to adjust the application's user interface to editing mode. When the table exits editing mode (for example, the user taps the Delete button), the table view calls tableView:didEndEditingRowAtIndexPath:.

In tableView:willBeginEditingRowAtIndexPath:, set a flag that editing mode was triggered using swipe to delete. Then, in setEditing:animated:, check the flag to see if editing mode was triggered normally or using swipe to delete and perform some action based on that check. Lastly, reset the flag in tableView:didEndEditingRowAtIndexPath: so that the default action will be performed when the edit button is pressed.