CALayer hierarchy, Best way to bring it to context exactly as shown on screen

What is the best way to bring the whole CALayer hierarchy into context (hence UIImage, PDF)?

My hierarchy contains CATransformLayer , CATextLayers , CAReplicatorLayers and CAShapeLayers plugins .

It looks great on screen, but I never make it look the same in UIImage (and I don't want to use screenshot-like rendering as I want CAShapeLayers and CATextLayers to display as vertex graphics in PDF)

Here are some of the problems I am facing:

  • rendering ignores the zPosition and translation.z property in the transform, it is strictly determined by the order in the sublayers of the array.
  • My layers have frames / positions / transforms, blended and often when rendering, the layers move (pseudo-randomly).
  • Sometimes CAReplicatorLayers are simply ignored and only the first instance is passed to the CGContext
  • Once the transform.z value transforms to a nonzero value, this layer completely ignores its transform and is mapped to (0, 0), I worked around this by manually ordering the layers and setting the zTranslation to 0, but this is not very convenient.

I hope some of you know a simple and safe way to put everything in context exactly as shown on the screen!

+3


source to share





All Articles