2012-04-15 203 views
0

我已經搜索周圍,看到各種答案,但尚未解決我的問題在這裏。我試圖將我的UITableViewCell背景顏色設置爲白色以外的其他顏色。我有更改表格單元格背景顏色

cell.contentView.backgroundColor = [UIColor colorWithRed:0.949 green:0.949 blue:0.949 alpha:1.0]; 

但這並不改變accesoryView的背景顏色,我目前的披露指標。我曾嘗試過:

cell.accessoryView.backgroundColor = [UIColor colorWithRed:0.949 green:0.949 blue:0.949 alpha:1.0]; 

無濟於事。我也嘗試將其設置爲清晰並與其他背景顏色相混淆。我在這裏錯過了什麼?這似乎是一個簡單的修復。

回答

0

嗯,這不可能是任何容易...

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 
    cell.backgroundColor = [UIColor colorWithRed:0.949 green:0.949 blue:0.949 alpha:1.0]; 
} 

新手的錯誤,顯然。

相關問題