Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 870
Jlexyc Avatar asked Nov 18 '25 16:11

Jlexyc


1 Answers

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];
like image 182
Jlexyc Avatar answered Nov 20 '25 06:11

Jlexyc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!