Alex Terente
Alex Terente

Reputation: 12036

What is the problem with groupTableViewBackgroundColor on iPad?

My background color is white! Why? Just start an new View-based app for iPad and set background color in viewDidLoad.

  - (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
}

What is wrong. If I set it to redColor it works. Why?

Upvotes: 4

Views: 1630

Answers (2)

jerry
jerry

Reputation: 274

groupTableViewBackgroundColor does not work for iPad. It is iPhone only. Instead, you can use

UIColor *clr = [UIColor colorWithRed:0.875 green:0.88 blue:0.91 alpha:1];
[[self view] setBackgroundColor:clr];

Upvotes: 0

Anomie
Anomie

Reputation: 94794

groupTableViewBackgroundColor on the iPad (or at least on an iPad with iOS 4.2) is the same as clearColor, rather than the pattern used on the iPhone. You can create a "color" with your own background pattern using UIColor's colorWithPatternImage: method.

Upvotes: 7

Related Questions