开发者

Setting backgroundView of UITableView cell

开发者 https://www.devze.com 2023-03-29 02:16 出处:网络
I\'m setting the background of a UITableViewCell and for whatever reason it will not appear. cell.textLabel.numberOfLines = 0;

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

精彩评论

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

关注公众号