Hello, I’ve been working on a drawing app for OS X in Objective-C for personal educational purposes. Thanks to the help I’ve received from various people in this list, this is coming along very nicely, but now I am once again calling for your help on a more complex subject.
My aim for this app is to provide some kind of “layer” functionality. I’ve already implemented a Layer class as an NSObject subclass, and I also have a panel to manage Layer objects, including creation, deletion, renaming, reordering, editing various attributes (locked, hidden, etc.). I also have implemented a custom view class CanvasView representing the app’s drawing canvas. I realise I could do all the drawing using this view’s drawRect: method. But somehow I keep having this feeling that I should pursue the usage of CALayer objects, possibly using them to form a composite object as part of my Layer class. What I have been trying to do so far is adding a CALayer property to my Layer class, so I can add a real CALayer object as a sublayer in my custom CanvasView reating a one-on-one relation between my Layers (that would contain the graphics data) and real CALayer objects (to display the graphics). I have assigned the Layer object as the CALayer object’s delegate… I’m exactly not sure why, but to me this seems to be a good strategy for performance considerations and possibly offering other advantages later on... However, I am not at all sure if this is the best route to take, so I would welcome any help or recommendations on this. Wether or not this is the best approach for my drawing app, I could also use some basic expert advise on Core Animation programming in general, and specifically on the usage of the CALayer class. I’ve read some of Apple’s docs and I will read them again and again, but maybe someone here could summarise some important basic concepts for me or touch on some misconceptions that beginners should watch out for. For instance, I have already been able to create and add sublayers to a layer-backed view, but it is still unclear to me how to draw graphic content in these layers. I know that there are various methods, but I still don’t have a clear picture of how layers generally fit together with custom views. I’ve read about the CALayer delegate property and the drawLayer:inContext: method, but I’m not sure who, when or how this method should be called. Thanks for any help, -- Luc Van Bogaert
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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com