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
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]