First make sure it's accessoryType is set:
cell.accessoryType = UITableViewCellAccessoryCheckmark;
And then in the
didSelectRowAtIndexPath
method:
// Toggle the "Tick" on and off
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;
}else if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
// This removes the highlighting of the Cell
[tableView deselectRowAtIndexPath:indexPath animated:YES];
No comments:
Post a Comment