I’m doing the following to set the cell image if a message is unread
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MessageCell"];
Message *m = [self.messages objectAtIndex:indexPath.row];
cell.textLabel.text = m.subject;
NSString *detail = [NSString stringWithFormat:@"%@ - %@", m.callbackName, m.dateSent];
cell.detailTextLabel.text = detail;
if([m.messageRead isEqualToString:@"False"])
cell.imageView.image = [UIImage imageNamed:@"new.png"];
return cell;
}
This is correctly showing an image when it’s supposed to. If I scroll down however and scroll back up, they all show the image whether it’s supposed to or not
Cells are reused. So you need to set each property for every condition.