2017-03-17 194 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

乾杯夥計:) –