CALayer vs. NSView performance with level support

I plan to have a view that can contain several hundred CALayer objects inside and next to each other. Thus, it should be as realistic as possible. These layers are not very complex. They are opaque and can be layers of text or shape. This number of layers must be compiled. For this, I would use CAConstraints .

From apples Documents:

Important. In OS X version 10.8 and later, it is recommended that you minimize the use of level hierarchies and simply use layer-aware images. The layer redrawing policies introduced in this version of OS X allow you to customize the behavior of your layer-supported views and still get the performance you could use previously using stand-alone layers.

I know that CALayer objects are lighter than representations. I'm not sure why we should use only layered images instead of layers. Is this for ease of use with auto-layout, or are there more performance / memory reasons for this statement? I would like to get the maximum performance, as this code will work on both OS X and iOS.

Which direction should I go? Auto-layout and NSViews support or custom CALayer hierarchy?

+5
source share
1 answer

I decided to go with layer support. Performance is still very good. All views are exposed using stackViews.

0
source

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


All Articles