Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableViewCell color issues with custom table view background

I have a UITableView with a custom background image set like this:

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"mybg.png"]];

The background appears fine, but my UITableViewCells (default cells, not custom) have some sort of weird tint to them, and the UILabel containing the "New Project" text also seems to have some sort of background behind it. How can I remove this? I've already tried:

cell.backgroundColor = [UIColor clearColor];
cell.textLabel.backgroundColor = [UIColor clearColor];

Thanks

alt text http://cl.ly/Cg5/content

like image 262
indragie Avatar asked Apr 02 '10 18:04

indragie


1 Answers

I believe that this is a nasty side-effect of simply adding an image straight into your table view's backgroundColor.

Try adding the image to the view's background color:

[[self view] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"mybg.png"]]];

and then set the table view's backgroundColor to be clear:

[[self tableView] setBackgroundColor:[UIColor clearColor]];

I hope this helps!

like image 105
Andy Bowskill Avatar answered Oct 20 '22 08:10

Andy Bowskill