Andrew H Andrew H - 2 months ago 14
iOS Question

UITableviewCell - Clicking on empty checkmark circle in edit mode does not select cell

I have a table view with several rows. I have enabled multiple selections in edit mode. When I toggle edit mode, I initially select all rows programmatically. Everything works fine except for re-selecting a row that was deselected by tapping on the empty circle where the checkmark was.

Table View Configuration:

Table View Configuration

Sample Cells, one has been deselected:

Sample cells

The interesting thing is that I can tap on the checkmark to deselect a row (

didDeselectRowAtIndexPath
is called), but immediately tapping on the same spot again will not call
didSelectRowAtIndexPath
. I have to tap on the main part of the cell. Naturally, this is not a good user experience.

Here is an overlay showing the areas that respond to taps highlighted in green.

table cells with overlay

I have been unable to find any events that are fired when tapping on the edit control of a deselected row. I have no code inside
didSelectRowAtIndexPath
or
didDeselectRowAtIndexPath
and I am just relying on the list of selected cells that the tableview maintains when the edit mode is toggled off. Any help isolating this issue would be greatly appreciated.

Answer

The problem ended up being that I was setting a backgroundView on my custom table cell and that was preventing the touches from getting to the right target.

Comments