UIView transparency shows how the sausages are made!

Posted by quixoto on Stack Overflow See other posts from Stack Overflow or by quixoto
Published on 2010-04-05T01:47:06Z Indexed on 2010/04/05 1:53 UTC
Read the original article Hit count: 352

Filed under:
|
|

I have a UIView container that has two UIImageViews inside it, one partially obscuring the other (they're being composed like this to allow for occasional animation of one "layer" or another.

Sometimes I want to make this container 50% alpha, so what the users sees fades. Here's the problem: setting my container view to 50% alpha makes all my subviews inherit this as well, and now you can see through the first subview into the second, which in my application has a weird X-Ray effect that I'm not looking for.

What I'm after, of course, is for what the user currently sees to become 50% transparent-- the equivalent of flattening the visible view into one bitmap, and then making that 50% alpha.

What are my best bets for accomplishing this? Ideally would like to avoid actually, dynamically flattening the views if I can help it, but best practices on that welcome as well. Am I missing something obvious? Since most views have subviews and would run into this issue, I feel like there's some obvious solution here.

Thanks!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiview