tags:

views:

155

answers:

2

in the interface builder,i can find the background tag,and select the color and the opacity.

if I create the UIView programmatically,if I want to change color,I can set the backgroundColor property

the question is if I want to change the opactiy,What is the property should I change?

Thanks a lot.

+3  A: 

Use the view's alpha property, or, if you don't want the view's content to have the same opacity change applied to it, change the alpha component of the background color (as created with +colorWithRed:green:blue:alpha:, +colorWithHue:saturation:brightness:alpha:, or +colorWithWhite:alpha:) to something other than 1.

Noah Witherspoon
+1  A: 

You can just use

self.alpha = someFloat;

in your view class.

If you want to change it from viewcontroller, use

self.view.alpha = someFloat;
EEE