I have a CALayer subclass. I have overridden the drawInContext method. I want the majority of my layer to be transparent except a few areas. I'm using the layer as a menu and I want the icons and labels on the menu to be opaque.

Is it possible to have a CALayer's sublayers be opaque if the super CALayer is transparent?

Is it possible to draw opaque tems in the drawInContext method of a transparent CALayer? I have tried using CGContextSetAlpha, but I assume it doesn't work since the CALayer that I am drawing for is transparent.

As always, any help would be great.

Was it helpful?


I found out that it is possible. A super layer does not dictate the transparency of its sublayer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow