开发者

Obj-C, how can I add a background colour to image I'm adding to cell.imageview, its a PNG?

开发者 https://www.devze.com 2023-03-31 09:22 出处:网络
I am using PNG images to add icons to the rows in my tableview, using [cell.imageView setImage:[UIImage imageNamed:@\"chart.png\"]];

I am using PNG images to add icons to the rows in my tableview, using

[cell.imageView setImage:[UIImage imageNamed:@"chart.png"]];

This was not a problem before, as my images had black edges and my tableview had black rows. However, I am now providing a light color style as well as dark. So the black edges look rough.

So I thought I would draw the images with a black background.

However, I don't know how to do t开发者_高级运维his?


UIImageView inherits from UIView so you can just set the backgroundColor property to show a color behind the transparant parts of your png image

[cell.imageView setBackgroundColor:[UIColor blackColor]];
0

精彩评论

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