Re: CALayer -drawInContext and GCD
Re: CALayer -drawInContext and GCD
- Subject: Re: CALayer -drawInContext and GCD
- From: David Duncan <email@hidden>
- Date: Thu, 2 Sep 2010 15:17:19 -0700
On Sep 2, 2010, at 11:29 AM, vincent habchi wrote:
> You mean I shall use your dispatch_async invocation instead of calling [layer setNeedsDisplay]?
Calling -setNeedsDisplay arranges for -display to later be called on the current runloop. As such using -setNeedsDisplay is reliant on a runloop running (and running regularly) neither of which you have on a GCD queue.
> I was thinking of calling dispatch_async () inside -drawInContext, but, if I understand your example correctly, this is wrong.
Doing so would cause you all manners of pain and suffering, the most common of which is things "mostly" working but occasionally your drawing going into the wrong view. Basically *never* use the context given to you in -drawInContext: outside of that invocation.
--
David Duncan
_______________________________________________
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