0
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

iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
Naveen Shan
  • 9,192
  • 3
  • 29
  • 43
  • 2
    Similar to: http://stackoverflow.com/questions/1164459/changing-uitableviewcell-textlabel-background-color-to-clear/2643451#2643451 – iwasrobbed Mar 21 '11 at 14:40

3 Answers3

1

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]];
}
Tieme
  • 62,602
  • 20
  • 102
  • 156
0
-(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.

visakh7
  • 26,380
  • 8
  • 55
  • 69
Waqass Karim
  • 71
  • 1
  • 4
0

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

shim
  • 9,289
  • 12
  • 69
  • 108
stefat
  • 154
  • 1
  • 4