I have some custom, CoreAnimation based UI. I'd like to implement mouse dragging of certain CALayers and I'd like to stick an image of dragged layer to the cursor. The problem is, that I can't get the CALayer (which isn't image/.contents based) into an image of some kind - like CGImageRef or NSImage. Any ideas?
CALayer has a renderInContext: method, which accepts a CGContextRef
.
After rendering to the context, you can obtain a CGImageRef
by calling CGBitmapContextCreateImage(CGContextRef context)
.
I already answered a similar question here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With