Re: CALayer subclass question
Re: CALayer subclass question
- Subject: Re: CALayer subclass question
- From: Huibert Aalbers <email@hidden>
- Date: Wed, 4 Jun 2008 10:57:19 -0500
Brian,
Thanks, but it didn't work. My understanding is that either
setNeedsDisplay or setNeedsDisplayOnBoundsChange:YES can be used to
force the layer to draw its content, but something is not working for
me.
Huibert
On 04/06/2008, at 10:49 a.m., Brian Christensen wrote:
On Jun 4, 2008, at 11:19, Huibert Aalbers wrote:
I am starting to work with Core Animation. I have tried to subclass
CALayer but I am having problems because for some reason the
drawInContext method never gets called, even though I invoke
setNeedsDisplay on the layer.
What is weird though is that if I override the display method I can
see that it gets called properly. My understanding is that the
default implementation of the display method invokes drawInContext.
So, my question is, what could I be doing wrong that could explain
this behaviour?
Have you tried setting the "needsDisplayOnBoundsChange" property of
the layer to YES? That should do the trick.
This is probably a pretty basic question but I haven't been able to
find any complete examples on how to properly subclass NSLayer.
Everyone seems to believe that it is either unnecessary or complex.
Jens Alfke wrote a turn-based game engine using Core Animation and
he makes fairly extensive use of CALayer subclassing. It's a great
starting point, even just to poke around and see how some things can
be done. You can grab it here: <http://mooseyard.com/hg/hgwebdir.cgi/GeekGameBoard/archive/tip.zip
>
/brian
_______________________________________________
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