Re: Snapshotting hidden UIViews
Re: Snapshotting hidden UIViews
- Subject: Re: Snapshotting hidden UIViews
- From: Michael Gardner <email@hidden>
- Date: Thu, 14 Jan 2010 11:22:19 -0600
On Jan 13, 2010, at 10:30 PM, glenn andreas wrote:
> On Jan 13, 2010, at 9:46 PM, Michael Gardner <email@hidden> wrote:
>
>> On Jan 13, 2010, at 5:07 PM, glenn andreas wrote:
>>
>>>
>>> On Jan 13, 2010, at 4:48 PM, Michael Gardner wrote:
>>>
>>>>
>>>> I also tried calling -drawRect: on my hidden view (after setting the context with UIGraphicsBeginImageContext()), but it doesn't seem to do anything.
>>>>
>>> Many built in views do not draw anything at all (and have no useful drawRect:) - all of their rendering is handled by the view's layer.
>>
>> Ah, that explains that. But I'd still very much like to know why the layer's -renderInContext: doesn't work consistently when the view is hidden.
>>
>
> Pure speculation, but a hidden view may not have a layer associated with it, and things like subview layout aren't done for hidden views (why waste cycle laying out the subviews if nobody will see it?). There are probably other undocumented optimizations as well on hidden views, such as animations not running, pending refreshes postponed, etc... UIWebView is going to be especially problematic, since it does a whole lot of things in the background (such as loading needed images and other resources)
That still leaves the question of how to capture the contents of a UIView in an image when the view isn't visible.
By the way, I tried the trick Matt suggested earlier in the thread, by obscuring my view behind another one instead of making it hidden. It didn't work. Is UIKit smart enough to know that a view behind another (opaque) view is effectively hidden?
-Michael_______________________________________________
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