views:

43

answers:

2

How to make a CALayer and all the things inside it semi-transparent? That includes all the things drawn with CoreGraphics and CoreText.

layer.opacity = 0.5
+2  A: 

Set layer.opacity = 0.5 or whatever you want it to be.

jtbandes
Heh, I started reinventing the wheel O.o. Thanks!
Nick Brooks
That doesn't apply to CoreGraphics elements
Nick Brooks
It should apply to everything in the layer. Can you provide more detail as to what you're doing?
jtbandes
Drawing filled rectangles with CoreGraphics. They stay opaque.
Nick Brooks
Where are you drawing them?
jtbandes
On a sublayer...
Nick Brooks
This should work, then.
jtbandes
A: 

Depending on your application, one thing to keep in mind apart from jtbandes answer, is going to be performance. Transparency on the iDevice platforms is not a fast operation, so doing too much of it can be a bad thing. Please keep this in mind.

jer