UITableVIew控制器采用全黑色

时间:2013-06-28 08:36:10

标签: ios objective-c

我要求以完全黑色显示 UITableViewController

我正面临以下问题

我将单元格的背景颜色设置为黑色。我只有四个条目,因此这四个cells为黑色,带有白色文字。但是现在还显示了其他空单元格,并且这些单元格为白色

6 个答案:

答案 0 :(得分:5)

给你

self.view.backgroundColor = [UIColor blackColor];

还要给予

self.myTableView.backgroundColor = [UIColor clearColor];

如果您不想查看separatorStyle的{​​{1}},请同时编写以下代码。

UITableViewCell

如果您使用所有此代码,则可以看到self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone; 完全黑色。

答案 1 :(得分:2)

将tableView背景颜色设置为黑色,并将单元格的背景颜色设置为清晰颜色。它应该工作。

答案 2 :(得分:0)

只需从xib中设置你的tableview的背景颜色黑色,如

enter image description here

使您的细胞背景颜色为clearColor。

答案 3 :(得分:0)

[self.tableView setBackgroundColor:[UIColor blackColor]];

答案 4 :(得分:0)

从tableview中删除多余的空单元格。

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
 {

    if ([self numberOfSectionsInTableView:tableView] == (section+1))
    {

        return [UIView new];

    }

    return nil;

}

答案 5 :(得分:0)

你需要将tableview背景颜色设为黑色。

[yourtableview setBackgroundColor:[UIColor blackColor]];

并删除单元格背景颜色意味着清晰的颜色,它将适合您。