Ben Packard
Ben Packard

Reputation: 26506

Strange behavior of showingDeleteConfirmation on UITableViewCell

A UITableViewCell has a showingDeleteConfirmation flag that you can read. As the name suggests, this allows you to know if the cell is showing the 'delete' button. There are two ways this delete button can be displayed:

  1. Swiping across a row.
  2. Entering edit mode for the cell and then pressing the '-' icon on the left of the row.

I set up some logging to check the value of this flag in the cell's willTransitionToState:. And I found something that confuses me.

In example (1), showingDeleteConfirmation is YES both when swiping across the row and when exiting editing for the cell (by touching outside the row after the swipe).

In example (2), showingDeleteConfirmation is NO when touching the '-' icon, but YES when exiting editing for the cell (again by touching outside the row).

First, can someone confirm this is the case, and that it is not a quirk of my UITableViewCell subclass.

Why would this be inconsistent? In my opinion behavior (2) is better, since it describes what is on screen at the time willTransitionToState: is called.

Upvotes: 2

Views: 633

Answers (1)

jszumski
jszumski

Reputation: 7416

Have you tried checking your logic in didTransitionToState: instead? It seems to make sense that at the instance you tap the minus button it would be NO and that later once the animation has finished it would change to YES.

Upvotes: 1

Related Questions