For the cell to appear selected, you have to call -setSelected:animated:
from within -tableView:willDisplayCell:forRowAtIndexPath:
like so:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if (/* should be selected */) {
[cell setSelected:YES animated:NO];
}
}
Calling -setSelected
from anywhere else has no effect.