I am confused a little bit about settings table view cell accessories.
I have fixed two sections in my table
What I
Here's how I do it with static cells, and bypassing cellForRow
Create a var that stores the location of the "checked" cell.
NSInteger _checkedCell;
Then just implement willDisplayCell
and didSelectRow
methods like this.
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if (_checkedCell == indexPath.row) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
_checkedCell = indexPath.row;
[self.tableView reloadData];
}