Am I correct in thinking that to change the checkmark for "on" to "off", I must change the CellAccessoryType
between none
and checkmark
on the didSelectRowAtIndexPath
?
Because I have done this but I have noticed the behaviour is not perfectly identical to like the checkmark cells on the auto lock settings on the iphone.
Or is there some other way checkmarks are meant to be handled?
-
Keep a property in your view controller called
selectedRow
, which represents the index of a row that represents the checked item in a table section.In your view controller's
-tableView:cellForRowAtIndexPath:
delegate method, set theaccessoryType
of thecell
toUITableViewCellAccessoryCheckmark
if the cell'sindexPath.row
equals theselectedRow
value. Otherwise, set it toUITableViewCellAccessoryNone
.In your view controller's
-tableView:didSelectRowAtIndexPath:
delegate method, set theselectedRow
value to theindexPath.row
that is selected, e.g.:self.selectedRow = indexPath.row
Jonathan : Sorry, I did not mean that I had multiple checkmark cells (more like radio buttons). Just they didn't animate as smoothly (but I fixed that now). But your answer means I am using the correct methods :)
0 comments:
Post a Comment