UITableView backgroundColor在iPad上始终为灰色 [英] UITableView backgroundColor always gray on iPad

查看:153
本文介绍了UITableView backgroundColor在iPad上始终为灰色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我为 UITableView 设置 backgroundColor 时,它在iPhone(设备和模拟器)上工作正常,但不是iPad模拟器。相反,我为我设置的任何颜色设置浅灰色背景,包括 groupTableViewBackgroundColor

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.

重现的步骤:


  1. 创建一个新的基于导航的项目。

  2. 打开RootViewController.xib并将表视图样式设置为 Grouped。

  3. 将此响应者添加到RootViewController:

  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];
}


  • 选择模拟器SDK 3.2,构建并运行。

  • 您将获得黑色背景(设备和模拟器)。

  • 在项目树中选择目标。

  • 单击项目:升级当前目标iPad。

  • 构建并运行。

  • 您将获得浅灰色背景。

  • 还原表格查看样式为Plain,你将获得黑色背景。

  • Select Simulator SDK 3.2, build and run.
  • You will get a black background (device and simulator).
  • Select your target in the project tree.
  • Click on Project : Upgrade Current Target for iPad.
  • Build and run.
  • You will get a light gray background.
  • Revert the table view style to Plain and you will get a black background.
  • 感谢您的帮助!

    推荐答案

    尝试其中一种。

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

    这篇关于UITableView backgroundColor在iPad上始终为灰色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆