Setting backgroundView of UITableView cell
I'm setting the background of a UITableViewCell and for whatever reason it will not appear.
cell.textLabel.numberOfLines = 0;
cell.textLabel.font = [UIFont fontWithName:@"Arial" size:15];
cell.textLabel.text = [[_comments objectAtIndex:indexPath.row] text];
((UIImageView *)ce开发者_Python百科ll.backgroundView).image = [UIImage imageNamed:@"bubble.png"];
cell.imageView.image = [UIImage imageNamed:@"user.png"];
return cell;
Everything but the cell.backgroundView
works. Am I doing something wrong?
Shouldn't have type casted it.
Solution was to set a UIImageView
image and then set it directly.
UIImageView *bgView = [[UIImageView alloc] init];
(bgView).image = [UIImage imageNamed:@"bubble.png"];
cell.backgroundView = bgView;
[bgView release];
精彩评论