ipaduitableviewiphone-sdk-3.2background-color

UITableView backgroundColor always gray on iPad


When I set the backgroundColor for my UITableView it works fine on iPhone (device and simulator) but NOT on the iPad simulator. Instead I get a light gray background for any color I set including groupTableViewBackgroundColor.

Steps to reproduce:

  1. Create a new navigation-based project.
  2. Open RootViewController.xib and set the table view style to "Grouped".
  3. Add this responder to the RootViewController:

    - (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor blackColor];
    }
  4. Select Simulator SDK 3.2, build and run.
  5. You will get a black background (device and simulator).
  6. Select your target in the project tree.
  7. Click on Project : Upgrade Current Target for iPad.
  8. Build and run.
  9. You will get a light gray background.
  10. Revert the table view style to Plain and you will get a black background.

Thanks for your help!


Solution

  • Try one of these.

    [myTableView setBackgroundView:nil];
    [myTableView setBackgroundView:[[[UIView alloc] init] autorelease]];