iphone - iPad : how to change background color for Ipad app?

标签 iphone objective-c ios ipad background

我正在为 iPhone 和 iPad 开发应用程序,它在 iPhone 上运行良好,但对于 iPad,它提供全灰色背景色,而我想要全蓝色背景色。我正在使用两个 xib 文件并在代码中执行此操作。我在 iphone 上工作正常,但在 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]; 

}

我什至把这些行放在上面的代码中然后它给出了下面的图片结果否则它显示所有灰色背景。

  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

最佳答案

试试这个:

[myTableView setBackgroundView:nil];

关于iphone - iPad : how to change background color for Ipad app?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7722313/

相关文章:

ios - iOS应用中的Google Translate API集成

iphone - 同步访问 UITableViewDelegate 逻辑

iphone - ARC 和 Storyboard 的兼容性

iphone - 同时编写 iPhone、BlackBerry 和 Android 手机的技术?

iphone - UIImageView:结合 UIViewContentModeScaleAspectFit 和 UIViewContentModeBottom

ios - Xcode - iPad 上的约束 - 横向与纵向

objective-c - 在 Objective c 中声明或不声明

objective-c - C 函数中的 _cmd 值

iphone - 使用用户方向旋转 MKmap

iphone - 帮助我 - iOS 版本问题