Reputation: 11
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.
Upvotes: 1
Views: 2364
Reputation: 4536
You can just use
self.alpha = someFloat;
in your view class.
If you want to change it from viewcontroller, use
self.view.alpha = someFloat;
Upvotes: 1
Reputation: 57139
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.
Upvotes: 4