Skip to content

Instantly share code, notes, and snippets.

@UjwalManjunath
Created August 1, 2013 19:14
Show Gist options
  • Save UjwalManjunath/6134307 to your computer and use it in GitHub Desktop.
Save UjwalManjunath/6134307 to your computer and use it in GitHub Desktop.
adding checkmark accessary to multiple sections(checking one cell at a time in each section)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForItem:indexPath.row inSection:indexPath.section]].accessoryType = UITableViewCellAccessoryCheckmark;
[self deSelectOtherCellsInTableView:tableView Except:indexPath];
}
-(void)deSelectOtherCellsInTableView:(UITableView *)tableView Except:(NSIndexPath *)indexPath{
for(UITableViewCell *cell in [tableView visibleCells]){
NSIndexPath *index = [tableView indexPathForCell:cell];
if(index.section == indexPath.section && index.row != indexPath.row){
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment