Reputation: 3240
I got settings view in my iOS app which presented by UITableView
. This app is universal, so you can run it on iPhone and on iPad. This table should be with custom background. And use this code for setting image for background:
table.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"settings_bg"]];
This is OK for iPhone:
But on iPad this background is grey!
Why? How should i set custom background for iPad? Thnx.
Upvotes: 0
Views: 487
Reputation: 69027
This is somehow a known difference between iPhone and iPad UITableView behaviour in the grouped mode. Use this code instead (or similar):
if ([self.tableView respondsToSelector:@selector(backgroundView)]) {
[self.tableView setBackgroundView:nil];
UIView* bkgView = [[[UIView alloc] initWithFrame:self.tableView.bounds] autorelease];
bkgView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:...]];
[self.tableView setBackgroundView:bkgView];
}
Upvotes: 1