2011-03-21 117 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]]; 

这对我有用。

背景颜色是一个真正的噩梦! 好运