Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView background color iOS 9

I have a UITableView that I want to set its background color to transparent. Background color for the table view and all subviews at interface builder is set to transparent. It works fine for iOS 8 & 7. but, not iOS 9. any idea?

cellForRowAtIndexPath method:

[cell setSelectedBackgroundView:[[UIView alloc] init]];
[cell.selectedBackgroundView setBackgroundColor:[UIColor clearColor]];
[cell setBackgroundColor:[UIColor clearColor]];
[cell.contentView setBackgroundColor:[UIColor clearColor]];
[cell setBackgroundView:[[UIView alloc] init]];
[cell.backgroundView setBackgroundColor:[UIColor clearColor]];
like image 1000
hasan Avatar asked Aug 09 '15 11:08

hasan


1 Answers

Objective-c:

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

Swift:

self.yourTableView.backgroundColor = .clear

XCode 7.0 bug. Not picking up from Storyboard

like image 93
Vipulk617 Avatar answered Oct 15 '22 15:10

Vipulk617