Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uitableview setbackgroundcolor not setting the color in UITableViewStyleGrouped table

Tags:

ios6

in iOS 6

[uitableview setBackgroundColor:] not setting the color when table style is UITableViewStyleGrouped

instead the default striped background is seen.

How should we set the background of the table if the style is UITableViewStyleGrouped

like image 653
Anand Avatar asked Sep 13 '12 14:09

Anand


3 Answers

[tableViewInstance setBackgroundView: nil];
like image 90
Eric Sellin Avatar answered Jan 11 '23 06:01

Eric Sellin


Setting

[tableView setBackgroundView: nil];

gives me problems in iOS 5 so what I use is:

UIView* bview = [[UIView alloc] init];
bview.backgroundColor = [UIColor yellowColor];
[tableView setBackgroundView:bview];

iOS 5 and 6 compatible!

like image 24
Farmertjes Avatar answered Jan 11 '23 06:01

Farmertjes


self.view.backgroundColor = TTSTYLEVAR(mainPageBackground);
self.tableView.separatorColor   = TTSTYLEVAR(mainPageBackground);
self.tableView.backgroundView = nil;

Fixed it for me. You'll have to be careful of what other impacts this might have though.

like image 44
DavidM Avatar answered Jan 11 '23 05:01

DavidM