Naveen Shan
Naveen Shan

Reputation: 9182

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 clear the cell text background color.

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

thanks in advance

Upvotes: 0

Views: 1236

Answers (3)

stefat
stefat

Reputation: 154

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

Upvotes: 0

Tieme
Tieme

Reputation: 65519

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]];
}

Upvotes: 1

Waqass Karim
Waqass Karim

Reputation: 71

-(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.

Upvotes: 0

Related Questions