Question

I want to draw a simple UIImage on CGLayer, but I cannot find any useful resources to do it. Kindly tell me how to draw UIImage on CGLayer.

Thanks!

Was it helpful?

Solution

Is it this you are looking for ?

CGContextRef layerCtx = CGLayerGetContext(layer);
 CGContextDrawImage(layerCtx, (CGRect){ CGPointZero, myImage.size }, myImage.CGImage);

OTHER TIPS

You need to get the Graphic context from the CGLayer, using the CGLayerGetContext function. After that, just push the new context into the stack, and draw the image inside the graphic context.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top