2011-03-21 120 views
0
cell.textLabel.backgroundColor = [UIColor clearColor]; 

在iPad3.2.2中不起作用,但它在4.2中正常工作。UItableviewcell textlabel背景顏色問題

可以在明確的單元格文本背景顏色任何人的幫助。

我的要求是什麼,我需要顯示cell.backgroundView清楚。

在此先感謝

+2

類似:http://stackoverflow.com/questions/1164459/changing-uitableviewcell-textlabel-background-color-到清晰/ 2643451#2643451 – iwasrobbed 2011-03-21 14:40:29

回答

1

默認的UIKit選擇它的時候將會把所有子視圖的backgroundColor的。

如果你想要的東西不同的子類的UITableViewCell這種方法添加到您的子類:

- (void)setSelected:(BOOL)selected animated:(BOOL)animated { 
    [super setSelected:selected animated:animated]; 

    [[self textLabel] setBackgroundColor:[UIColor clearColor]]; 
    [[self detailTextLabel] setBackgroundColor:[UIColor clearColor]]; 
} 
0
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 

    [[cell textLabel]setBackground:[UIColor clearColor]]; 

} 

試試這個兄弟,我希望做工精細非常的iOS版本。

0

我有一個iPad同樣的問題運行4.3.3。

[cell.textLabel setBackgroundColor:[UIColor grayColor]]; 

這對我有用。

背景顏色是一個真正的噩夢! 好運