UIWebView over UIView gets UIView alpha value

I am developing an iOS 4 app.

I have a main view containing another UIView

named shadowView

with UIWebView

inside. This one shadowView

has a black background color and alpha = 0.3f.

My problem is that UIWebView

inherits the shadowView

alpha value and I don't want that, I need the UIWebView to have alpha = 1.0.

Do you know how I can do this?

+3


source to share


1 answer


If I understand your question, you added UIWebView

in UIView

which has an alpha of 0.3.

On iOS, any subsets inherit their parent views of alpha values ​​(or rather, the parent view "masks" the subview).

It sounds like you want yours to shadowView

have a semi-transparent background: instead of setting an alpha representation, you should do this:



[shadowView setAlpha:1.0];
[shadowView setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.3]];`

      

... which will (until your view is opaque) will give you a nice semi-transparent background and will allow your sub-views to not appear transparent as well.

+6


source







All Articles