How to add a bare CALayer as a "subview" in a UIView?

I think adding CALayer as a "subview" saves a lot of memory anyway. UIView always comes with 3 copies of its bitmap (presentation level, rendering tree and more, plus the view itself, so each pixel is saved 4 times). But how can this be done?

+3
source share
1 answer

UIView is basically a wrapper for CALayer. This way you can add a layer directly to the presentation layer. This can be done by calling

[[theView layer] addSublayer:newLayer];
+14
source

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


All Articles