Re: -renderInContext: with multiple layers?
Re: -renderInContext: with multiple layers?
- Subject: Re: -renderInContext: with multiple layers?
- From: Kyle Sluder <email@hidden>
- Date: Mon, 15 Aug 2011 15:46:12 -0700
On Mon, Aug 15, 2011 at 2:47 PM, Rick Mann <email@hidden> wrote:
> Hi. I have two UIView hierarchies, visually side-by side, but at different parts of an overall view hierarchy. I'd like to create a single UIImage of the two, using -renderInContext: and UIGraphicsGetImageFromCurrentImageContext(). I was able to make one work alone just fine. But when I make my graphics context (using UIGraphicsBeginImageContext()) large enough to encompass both, and set each UIView's frame so that they are side-by-side, the resulting image shows just the left-cell's content, squished horizontally.
Yes, but you need to set up the CTM to draw the layers in the right
place. To be clear, you're asking the views' layers to
-renderInContext:, not the views themselves.
We use -renderInContext: to draw entire layer trees into one big
context. You obviously aren't doing the same thing, but the principle
is identical. You might want to look into our CALayer extension method
for doing so: https://github.com/omnigroup/OmniGroup/blob/master/Frameworks/OmniQuartz/CALayer-OQExtensions.m#L497
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden