I have to implement multiple selection of the row from different section. So here is my code
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
EmailSelectionCell*cell;
cell = (EmailSelectionCell *)[tableView dequeueReusableCellWithIdentifier:@"EmailSelectionCell"];
if(cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"EmailSelectionCell" owner:self options:nil];
cell = EmailSelectionCell;
}
NSArray *insuranceEmailArray = [[data objectAtIndex:indexPath.section] objectForKey:@"email"];
[((EmailSelectionCell *) cell).lbl_name setText:[insuranceEmailArray objectAtIndex:indexPath.row]];
return cell;
}
In tableview cell
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
if(selected){
imgv_selectionBox.image = [UIImage imageNamed:@"tick_selected"];
}else{
imgv_selectionBox.image = [UIImage imageNamed:@"tick_unselected"];
}
}
My problem is that setSelected is calling twice when i debug and one more problem is that it is behaving like single selection. I am thinking the problem is due to section but i don't know how to handle it. So please help to resolve this kind of problem.