Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIColor colorWithPatternImage: transparency issues in UITableView's separatorColor

I have troubles with setting my patterned UIColor. In iOS 5 it's all good, but in iOS 4.3 I get the issue. I added an image for better understanding. I already Googled a bit, and found that the answer is possibly the setting of the opaque property to NO. But I already set every view, contentView, backgroundView, tableViewCell it's opaque value to NO.

You can see that the separator color is black, where the image has of the pattern has transparency

You can see that the separator color is black, where the image has of the pattern has transparency

like image 582
Dries De Smet Avatar asked Nov 30 '11 11:11

Dries De Smet


1 Answers

This appears to be a bug in iOS 4.3 that they fixed in 5.0 .

To get this to work on 4.3, you'll need to set both the view and the layer to non-opaque, after setting the view's backgroundColor to the pattern image, like so:

UIImage* pattern = [UIImage imageNamed:@"translucentPatternImage.png"];
view.backgroundColor = [UIColor colorWithPatternImage:pattern];
[view.layer setOpaque:NO];
view.opaque = NO;
like image 191
Paul Scott Avatar answered Nov 16 '22 01:11

Paul Scott