Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad : Problem changing the background color of Grouped TableView in iOS SDK 4.2

I am using iOS SDK 4.2.

In my iPad app, I am not able to change the background color of Group Table View even it does not set to clear color

If I try to change the table view style from Grouped Table View to Plain Table View and then try changing the background color then it changes.

But something seems to be wrong when I am using Grouped Table View

What could be wrong?

What should I do?

Plese Help and Suggest

Thanks.

like image 759
ios Avatar asked Dec 20 '10 07:12

ios


3 Answers

Set nil to the tableview's backgroundView will solve the problem.

tableView.backgroundView = nil;

BackgroundView works only with ios 3.2 and later.
So check

if([tableView respondsToSelector:@selector(backgroundView)]) 
     tableView.backgroundView = nil; 

For backward compatibility, otherwise app will crash.

like image 97
Preetha Avatar answered Nov 19 '22 12:11

Preetha


I have this problem as well. Only on iPad. Only with a grouped Table.

You can fix this by creating a new view, coloring it and then setting that new view to the backgroundView of the tableView.

This works for static colors, but not Pattern Images(what I'm trying to do)

like image 27
John Avatar answered Nov 19 '22 12:11

John


There might be some problem in linking your outlet of table.
Setting the background color is not OS dependent.

You can easily set it through

[table setBackgroundColor:[UIColor blackColor]];  

Check your connections to nib file and delegate properly.

like image 1
Javal Nanda Avatar answered Nov 19 '22 14:11

Javal Nanda