Settings cell selected background view removes backgroundview
- by Chris
I'm trying to set up custom UITableViewCells. I can set the backgroundView no problem, but if I set selectedBackgroundView, the cell's background becomes white and only the selected background is seen:
- (void) createCell: (UITableViewCell*)cell onRow: (NSUInteger)row
{
UIImageView* bgImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_background_red.png"]];
cell.backgroundView = bgImage;
cell.selectedBackgroundView = bgImage;
cell.textLabel.hidden = YES;
UILabel* titleLabel = [[UILabel alloc] initWithFrame: CGRectMake(20, CGRectGetHeight(cell.frame) / 2, 200, 50)];
titleLabel.text = [[self.ruleList objectAtIndex: row] objectForKey: TitleKey];
titleLabel.backgroundColor = [UIColor clearColor];
[cell.contentView addSubview: titleLabel];
}