Search code examples
iphoneuitableviewuicolorios7

UITableViewCell background color with alpha different behavior


I set the same color ([UIColor colorWithWhite:1 alpha:0.8]) for TableHeader and for each Row (for in Row in layoutSubviews). It works great in iOS 6 and iOS 5 but in iOS 7 i'm getting different behavior.

This color works for header in the same way but for cell alpha became as 1. I've set it to 0.6 and appearance was like alpha 0.8 for iOS 6 or 5.

So problem is: by setting the same alpha for TableHeader (or other view) and for TableViewCell we will get different appearance, but I need the same and I don't want to hack.

And one more, with [UIColor colorWithWhite:1 alpha:0];

It becomes fully transparent, so i think that there is no views below.


Solution

  • I've found the best solution:

    self.backgroundColor = [UIColor clearColor];
    self.contentView.backgroundColor = [UIColor colorWithRed: 68.0/255.0 green: 125.0/255.0 blue: 190.0/255.0 alpha: 0.8];