I have an application in which i need to deselect the selected cell when the user selecting a new cell. I can do the selecting and deselecting the tableview rows, but the problem is I need to select only one row at a time. I was doing like this now,
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"white_cell_check.png"]];
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"white_cell.png"]];
}
but in this i can select and deselect the same row. But my intention is when selecting a new row if any other cells are selected already it needs to deselected. Can any body help me ?