开发者

UItableviewcell textlabel background color issue

cell.textLabel.backgroundColor = [UIColor clearColor];

does not work in iPad3.2.2 but it works fine in 4.2.

can anyone help in clea开发者_StackOverflowr the cell text background color.

what my requirement is I need to show the cell.backgroundView clearly.

thanks in advance


By default UIKit will set the backgroundColor's of all subviews when selecting it.

If you want something differently subclass UITableViewCell and add this method to your subclass:

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

    [[self textLabel] setBackgroundColor:[UIColor clearColor]];
    [[self detailTextLabel] setBackgroundColor:[UIColor clearColor]];
}


-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

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

}

Try this brother I hope work fine in very iOS version.


I have the same issue in an iPad running 4.3.3.

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

this works to me.

Background color is a real nightmare ! good luck

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜