Ad

Our DNA is written in Swift
Jump

Radar: Swipe-to-Edit on UITableView

Working on the prod.ly app (see screen shot below) I found this problem when adding actions to table view cells via the new editActionsForRowAtIndexPath: API. If you have a UIButton in the cell then the swipe does not cancel the tap on the button and you can end up accidentally executing the button action when you only wanted to edit.

Filed as rdar://19411256 and on Open Radar.

tableView:didEndEditingRowAtIndexPath: not being called following cancelled swipe-to-edit

Summary

The tableView:didEndEditingRowAtIndexPath: delegate method is not being called if the swipe-to-edit gesture is cancelled with the editing actions opened too little.

This is a problem if you have a UIButton inside the table view cell, because if you start the swipe-to-delete gesture over the button, then both the button as well as the editing action are executed. The provided delegate methods would allow me to enable/disable interaction with this button during editing.

But this issue allows for a state to occur where the editing actions are not visible, but the button still being disabled. So the user would have to tap once to get the delegate method to fire and re-enable user interaction and another time to actually tap the button.

Steps to Reproduce

  1. Run the provided sample app
  2. Swipe any row to the left
  3. Note that it turns red
  4. tap anywhere to have the editing end, it turns green again
  5. Now swipe to the left, but only so far that the cell text begins to touch the left edge of the screen, then let go

Expected Results

  • the editing actions should be hidden
  • the tableView:didEndEditingRowAtIndexPath: should be called when they are

Actual Results

  • editing actions are hidden
  • tableView:didEndEditingRowAtIndexPath: is not called called
  • when you start scrolling the table view, it is called TWICE

Notes

Indeed the tableView:didEndEditingRowAtIndexPath: is called TWICE even during normal operation of showing the actions. Should I file another bug report for that?

The mentioned sample project ActionsBug is on my Radar Samples GitHub repo.

prod.ly app


Categories: Bug Reports

Leave a Comment