In my app I have one root layer, and many images which are sublayers of rootLayer. I'd like to flatten all the sublayers of rootLayer into one layer/image, that don't have any sublayers. I think I should do this by drawing all sublayers in core graphics context, but I don't know how to do that.
I hope you'll understand me, and sorry for my English.
Do you still want the layer to be interactive? If not, call
-renderInContext:
and show the bitmap context.From your own example for Mac OS X:
iOS:
Also note the caveat in the docs: