Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView Transparent

I just want to know how i can set a transparent background of an UITableView. I got this :

tableview.backgroundcolor = [UIColor clearColor];

But the cells stay white and not transparent.

Thank for help

Flo.

like image 889
Florian_accessdev Avatar asked May 01 '26 19:05

Florian_accessdev


1 Answers

That statement is correct for setting the tableView's background color to clear (transparent), not the cells.

You have to manipulate cells directly, as they themselves are views. When you set the background color of a table cell however, you are not setting the background color of its content view. So unless you do that specifically, you won't see through the cell. Try this to make transparent the cell background and the cell's contentView background:

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

(Written from memory here, not compiled... :-)

like image 142
Mark Granoff Avatar answered May 03 '26 23:05

Mark Granoff