2017-03-17 79 views
0

我遇到了一个奇怪的问题,我的一个tableView的backgroundColors,它只在iOS 9.2中看起来破损?UITableView - 单元格背景颜色不适用于iOS 9.2?

我试图通过SB,并通过代码都设置的backgroundColor:

cell.contentView.backgroundColor = [UIColor colorWithRed: 22.0/255 
                 green: 35.0/255 
                 blue: 55.0/255 
                 alpha: 1.0]; 

cell.accessoryView.backgroundColor = [UIColor colorWithRed: 22.0/255 
                 green: 35.0/255 
                  blue: 55.0/255 
                 alpha: 1.0]; 

enter image description here

在iOS的10工作正常,但?思考?我想删除所有TableView中的白色背景的东西要具体...

+0

试试看吧 - “故事板”中的“clearColor”contentView和单元格背景 – Kampai

+0

在单元格中,所有内容都变成白色。即使我有以下备份藏汉: self.tableView.backgroundColor = [的UIColor colorWithRed:22.0/255 绿:35.0/255 蓝:55.0/255 阿尔法:1.0]; – user1293618

回答

1
cell.backgroundColor=[UIColor clearColor];// in table view cell 

tableView.backgroundColor = "your color" // in view did load 

- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
cell.backgroundColor = "your color"; 
} 

cell.contentView.backgroundColor ="your color"; 
+0

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.backgroundColor =“your color”; }工作!棘手的问题。干杯! – user1293618

+0

干杯伙计:) –