When I reload my tableView, my custom cell button does not reload to its initial state. I would like to have the checks return to the "plusImage". Any idea why this isnt working? Does reloadData envoke new reused cells?
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *ReusableIdentifier = @"Cell";
SetListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ReusableIdentifier forIndexPath:indexPath];
cell.delegate = self;
UIImage *checkImage = [UIImage imageNamed:@"check.png"];
UIImage *plusImage = [UIImage imageNamed:@"plusButton"];
if ([self.selectedRows containsIndex:indexPath.row]) {
[cell.plusButton setBackgroundImage:checkImage forState:UIControlStateNormal];
}
else {
[cell.plusButton setBackgroundImage:plusImage forState:UIControlStateNormal];
}
cell.tag = indexPath.row;
return cell;
}
when the cell is prepareForReuse
-(void)prepareForReuse
{
UIImage *plusImage = [UIImage imageNamed:@"plusImage"];
[self.plusButton setBackgroundImage:plusImage forState:UIControlStateNormal];
self.plusButton.enabled = YES;
[super prepareForReuse];
}
}aftercell.tag = .... Would you please paste the complete code? - Armin