开发者

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]; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜