Armand
Armand

Reputation: 10254

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?

Upvotes: 0

Views: 515

Answers (2)

Paul Peelen
Paul Peelen

Reputation: 10329

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]];

Upvotes: 0

Radu Lucaciu
Radu Lucaciu

Reputation: 706

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

tableView.hidden = YES;

Upvotes: 3

Related Questions