I am using iOS SDK 4.2. I have an UIPopoverController initialized with a navigation controller which is initialized with a view controller. One of the subviews of the view controller is a grouped table view. I would like to change the background color of the table view. However, if I do in the viewDidLoad method of the view controller
self.myTableView.backgroundColor = [UIColor blackColor];
the background does not changes, when the popover appears, the background of the table view is gray. Any clue? What's wrong with this approach? Thank you in advance.
Grouped table views have a custom view in the backgroundView
property. This custom view is what displays the background. If you want to change the background, you should create your own view and assign it there. In your case, you probably want something like the following:
UIView *bgView = [[[UIView alloc] init] autorelease];
bgView.backgroundColor = [UIColor blackColor];
bgView.opaque = YES;
self.myTableView.backgroundView = bgView;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With