Reputation: 45921
I'm developing an iOS 4 application.
I have a main view that contains another UIView
, named shadowView
, with an UIWebView
inside. This shadowView
has black as background color and alpha = 0.3f.
My problem is that UIWebView
inherits shadowView
alpha value, and I don't want that, I need UIWebView has alpha = 1.0.
Do you know how can I do that?
Upvotes: 3
Views: 662
Reputation: 31304
If I understand your question, you have added a UIWebView
to a UIView
which has an alpha of 0.3.
On iOS, any sub-views inherit their parent views alpha values (or rather, the parent view 'masks' the sub-view).
It sounds as if you want your shadowView
to have a translucent background: rather than setting the alpha of the view, you should instead do this:
[shadowView setAlpha:1.0];
[shadowView setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.3]];`
...which will (as long as your view isn't set to be opaque) give you a nice translucent background and allow your sub-views to not appear transparent as well.
Upvotes: 6