You could keep a NSMutableArray*
called checkmarks
that stores NSNumber
instances.
Set +numberWithBool:
on each element of checkmarks
as YES
, for example, to mark all rows as checked.
Note that this is just a data model store. Thus, you have to actually read the values of checkmarks
in your -tableView:cellForRowAtIndexPath:
method to set the checkmark states for each row's accessoryType
, e.g.:
cell.accessoryType = ([[checkmarks objectAtIndex:indexPath.row] boolValue] == YES) ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
When you programmatically change the state of checkmarks
, you can then call [tableView reloadData]
so that the state of table view rows reflects the state of elements of checkmarks
.