3
votes

I have three views on top of each other inside a superview.

superview
 - subview 1 (CD Case)
 - subview 2 (Artwork)
 - subview 3 (Shine)

when I animate the alpha property of the superview it seams to affect the alpha of all subviews i.e. while the animation is running subview 1 the CD Case shines through the artwork.

While blending all three into one UIImage solves this problem, but for performance reasons this not really an option. (The views are display in a grid view and loaded on demand.)

Is there any other way to avoid this behaviour?

1
One of the options is to put a black (or some other color) cover on top with zero-alpha. Then fade it in. - debleek63
Worked perfectly fine. Thanks. - voidStern

1 Answers

19
votes

You can either reverse the fade, as suggested by @debleek63. Or you can change the shouldRasterize flag on the superviews layer.

myView.layer.shouldRasterize = YES

This will make it use 'group opacity' and everything should composite as you'd expect. The first way is probably more performant, but not as 'correct'.