I\'ve implemented a custom table view cell class that inherit from UITableViewCell
. The tableview contains a background image, so I want cell\'s background to b
I actually found that the issue arose from the UITableView's Background color not being set to clear. If you change the UITableViewCell's Background color to clear and you are finding you still see white, make sure that the UITableView's background color is set to clear (or whatever you want).
[self.tableView setBackgroundView:nil];
[self.tableView setBackgroundColor:[UIColor clearColor]];
In Swift
tableView.backgroundView = nil
tableView.backgroundColor = UIColor.clearColor()
It could be that your UITableViewCell is selected by default.. You can confirm this using Xcode 6s new visual debugger (or find out exactly which view is causing this white cell to appear).
Interestingly, after knowing this.. setting the background color of the selected cell to clear still didn't work.. doing some more research, turns out i just had to modify the selection style when i'm creating this custom cell:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// do customization here
}
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self setBackgroundColor:[UIColor clearColor]];
return self;
}