Frage

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!

War es hilfreich?

Lösung

Is it this you are looking for ?

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

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top