Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TableView background Image in iPad Application

I have following code which works fine in iPhone application but in iPad I always get grey/light blue background colour. Even if I change background colour it does not take effect.

[self.tableView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg1024x768.png"]]];

Thanks

like image 793
Leo Avatar asked Mar 03 '11 21:03

Leo


1 Answers

Here's the magic:

if ( [self.myTableView respondsToSelector:@selector(backgroundView)] )
    self.myTableView.backgroundView = nil;
self.myTableView.backgroundColor = [UIColor clearColor];

Also, use UIViewController with a UITableView, not UITableViewController, and place your background image in a UIImageView placed under the UITableView.

like image 62
Bogatyr Avatar answered Jan 01 '23 14:01

Bogatyr