I have a tableView that checks if a cell has being opened: if yes, it shows an empty cell (no image), if no, it shows a little image to state that the cell has not being read (opened) yet.
Now, i have the “favorites” function in my app, and i want to show a little image in the tableView that states that the cell is a favorite, so the user can quickly recognize those added to favorites right from the table.
I was trying to do, in cellForRowAtIndexPath method
NSDictionary *item = [rows objectAtIndex:indexPath.row];
cell.textLabel.text = [item objectForKey:@"name"];
if ([[item valueForKey:@"isRead"] boolValue] == NO) {
cell.imageView.image = [UIImage imageNamed:@"unread.png"];
} else {
if ([[item valueForKey:@"isFav"] boolValue] == YES){
cell.imageView.image = [UIImage imageNamed:@"favorite.png"];
}
else{
cell.imageView.image = nil;
}
cell.imageView.image = nil;
}
Where name, isRead, isFav are value took from a plist where i store all the data.
Of course when the user opens a cell, the “unread” image goes away.
The problem is now that i want to show BOTH unread and favorites. In the code above, it shows only those unread.
How can i do to achieve this? I’m missing something stupid maybe!
I solved thanks to the help of a dear friend, and i ended up doing something like