How to remove black background color from uitableviewcell from the portion where image should not be displayed?
Hello i have one iphone application in which an UITableViewCell
is added with a background image using the following code
tbView.backgoundColor=[UIColor colorWithImagePattern:[UIImage imagenamed:@"cellbg.png"]];
Image is added, but image should be displayed for some portion only.The portion in which image is n开发者_运维知识库ot displayed is shown in black color. I want to make that color white.
In picture above show the black that I want to remove where date, friday september is displayed. How can i do that. I have tried to add UIImage
as a subview to the cell.But the image is larger than the cell size.so it is scaled to cells size and becomes smaller and ins't displayed properly.
The issue got solved by adding imageview as backgroundview of table
UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellbac.png"]]; background.contentMode = UIViewContentModeTopLeft; tbView.backgroundView= background;
Try this below line of code:
tbView.backgoundColor=[UIColor clearColor];
or
tbView.backgoundColor=[UIColor whiteColor];
tbView.backgroundView.opaque = NO;
Put above line before you set your background image.
精彩评论