SDK

Alternating accessoryView and accessoryType in UITableViewCell

Quick post about a problem I had today.

I’m writing an app for a client that has a checklist component. So a UITableViewCell is in an unchecked state, and then when the user hits it, it becomes checked.

I like the look of the UITableViewCellAccessoryCheckmark, so I’m using it, but I needed something when the cell is unchecked, so I’m using a png that has a circle.

I was having a problem that when the cell was unchecked and I tapped on it, nothing appeared to happen, although if I went to another screen and came back to that one the check box would show up. But, if the cell was checked and I tapped on it, the circle would show up. Here’s the code that fixed it:

 2 min read