开发者

Changing UITableView to clear color

开发者 https://www.devze.com 2023-04-10 07:06 出处:网络
I want my UITableView to be completely invisible but I have set a lot of things and nothing seems to be working.

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

精彩评论

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