views:

584

answers:

2

So right now I have a UIView with a UILabel in it. I want the background to have an opacity < 1.0 and the label to have an opacity of 1.0. However since alphas propagate down the view hierarchy, the label ends up with an opacity < 1.0 as well.

Is there anyway to do what I want without making the UILabel a subview of another view??

+5  A: 

Just set the background color to be semitransparent:

view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.5];
Ian Henry
A: 

You can set the background color of the UIView with a semi-transparent color or make the image itself semi-transparent. This way it's a property of the view that is transparent, not the view itself.

Colin Gislason