Azhar
Azhar

Reputation: 20670

ipad : how to change background color for Ipad app?

I am developing application for iPhone and iPad both, its working fine in iPhone but for iPad it gives this full gray background color, while I want full blue background color. I am using two xib files and doing this in code. I works fine with iphone but not with ipad.

- (void)viewDidLoad {
    [super viewDidLoad];

     [[NSBundle mainBundle] loadNibNamed:@"LoginHeaderViewController" owner:self options:nil];
     self.tableView.tableHeaderView = tableHeaderView;


     [[NSBundle mainBundle] loadNibNamed:@"LoginFooterViewController" owner:self options:nil];
     self.tableView.tableFooterView = tableFooterView;
     self.view.backgroundColor = [UIColor colorWithRed: (66.0/255) green: (142.0/255) blue: (189.0/255) alpha: 1.0]; 

}

I even put these lines In above code then It gives the below pic result otherwise it show all gray background.

  tableHeaderView.backgroundColor = [UIColor colorWithRed: (66.0/255) green: (142.0/255) blue: (189.0/255) alpha: 1.0]; 
  tableFooterView.backgroundColor = [UIColor colorWithRed: (66.0/255) green: (142.0/255) blue: (189.0/255) alpha: 1.0]; 

enter image description here

Upvotes: 0

Views: 2833

Answers (4)

Marios
Marios

Reputation: 509

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

This will suit your background color change

Upvotes: 0

Suraj Mirajkar
Suraj Mirajkar

Reputation: 1401

 tableview.backgroundColor = color;

Set background view to nil using following :

 tableview.backgroundView = nil;  

Hope it will work

Upvotes: 0

Nitish
Nitish

Reputation: 14123

If you want blue background color then there is no need to assign color to tableHeader and tableFooter as the color of self.view is blue. So make the following changes:

tableHearder.backgroundColor = [UIColor clearColor];
tableHeader.backgroundView = nil;

tableFooter.backgroundColor = [UIColor clearColor];
tableFooter.backgroundView = nil;

Upvotes: 0

COD3BOY
COD3BOY

Reputation: 12112

Try this :

[myTableView setBackgroundView:nil];

Upvotes: 2

Related Questions