开发者

Changing UITableView to clear color

I want my UITableView to be completely invisible but I have set a lot of things and nothing seems to be working.

I use custom table cells.

This is what I set in the cell.h

self.textLabel.backgroundColor = [UIColor clearColor];
primaryLabel.backgroundColor = [UIColor clearColor];
secondaryLabel.backgroundColor = [UIColor clearColor];
self.backgroundColor = [开发者_开发百科UIColor clearColor];
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundView.backgroundColor = [UIColor clearColor];
self.accessoryView.backgroundColor = [UIColor clearColor];
self.selectedBackgroundView.backgroundColor = [UIColor clearColor];

And I also set

_tableView.backgroundColor = [UIColor clearColor];

But still it is not working, what am I missing?


Instead, you could use the hidden property of the tableView.

tableView.hidden = YES;


With regards to the "incorrect" answer given, I think you mean is that you want the tableView background to disapear (showing the views background).

If so, in your viewDidLoad, add the following: (given you made your tableView programmatically)

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

If you also don't want to show the lines for each cell:

[self.tableView setSeparatorColor:[UIColor clearColor]];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜