I have an application in which i am changing the cell background image when the user selects each row.Like this`
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
for (int i = 0; i < [tableView numberOfRowsInSection:0]; i++) {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
cell.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"white_cell.png"]];
}
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"white_cell_check.png"]];
if (indexPath != nil) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
`it is working fine.My problem is from the detailed view when i am poping back to the previous view Ie to the tableview controller the changed background image in the tableview stays like as.But i need it to be the normal one.Can anybody help me?
Just reload the table when your controller reappears, it will reload the data, and
didSelectRowAtIndexPathwill not get called, so your cell will have the initial background.