Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent background in grouped UITableView - iPhone

I want to make the grouped UITableView transparent. I partially succeded with the following code:

UIColor *bgColor = [[UIColor alloc] initWithWhite:1 alpha:0.0];
historyTable.backgroundColor = bgColor;

Unfortunately, black corners appeared in the rounded cells. How to get rid of them?

Before After

like image 592
Jacek Avatar asked Mar 07 '10 12:03

Jacek


3 Answers

Instead of using

UIColor *bgColor = [[UIColor alloc] initWithWhite:1 alpha:0.0]; historyTable.backgroundColor = bgColor; 

Just use:

historyTable.backgroundColor = [UIColor clearColor]; 

That also clears up the memory leak you were creating.

like image 157
Tom Irving Avatar answered Sep 22 '22 01:09

Tom Irving


remove UITableView backgroundView

xxx.backgroundView = nil; 

This is necessary on iPad builds. When compiling to run on iPad and iPhone, check the tableView responds to the selector with ...

if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) {     [self.tableView setBackgroundView:nil]; } 
like image 33
021850524 Avatar answered Sep 22 '22 01:09

021850524


for me it worked finaly after setting both to nil/clear:

[myTableView setBackgroundView:nil];
[myTableView setBackgroundColor:[UIColor clearColor]];
like image 22
zero3nna Avatar answered Sep 22 '22 01:09

zero3nna