Set opacity to CGLayer before the draw?

I have a subclass of UIView - actually a piece of the puzzle - with two different CGLayer initialized in initWithFrame.

In drawRect, I have to mix this two layers , and the top one should have the alpha variable depending on the game logic.

What is the best (most performance optimized) way to do this? Is there a CGLayer or CGContext function that sets alpha before drawing?

+3
source share
1 answer

-opacity . , -opaque . , YES.

-drawInContext:, CGContextSetAlpha(). , -drawRect: . , .

+6

Source: https://habr.com/ru/post/1727547/


All Articles