Delete layer by frame

How can I create / prepare a CALayer screen so that when he displays the page, all he needs to do is display the prepared level?

+3
source share
1 answer

Extract your content into the CGBitmapContext, pull out the CGImageRef and set it as the contents of the CALayer. See Creating a bitmap graphic context , for example, the code for most of this.

But if your real problem is that yours is drawInContext:too slow, you must first deal with this so that you can pre-calculate everything when the data changes, and only draws in drawInContext:. This is usually the best approach. Do not pre-render the layer; pre-compute everything you need to quickly render the layer. But for very complex drawing it is useful to use the CGImageRef approach.

+3
source

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


All Articles