Re: Request for guidance re. CALayer
Re: Request for guidance re. CALayer
- Subject: Re: Request for guidance re. CALayer
- From: Gordon Apple <email@hidden>
- Date: Wed, 07 Jan 2015 13:26:29 -0500
- Thread-topic: Request for guidance re. CALayer
We have a Mac application that uses CALayers (subclassed) for layered
drawing. Our drawing view uses a drawing delegate for drawing (rendering)
and a Edit delegate for interaction. The latter is in a view controller that
is also inserted into the view¹s responder chain. (Edit Delegate methods are
mainly for drag/drop methods, which are not forwarded in the responder
chain.) The Edit delegate knows which CALayer is the top layer, and
addresses the appropriate model layer. This works very well, and, in fact,
our CALayer architecture is considerably more complex than that, having
background layers, annotation layer, and other things.
Using CALayers gives you a lot of power to do things like include movie
layers, QClayers, live-video capture layers, etc. into individual layers
which can be overlaid by other CALayers, i.e., things you just can¹t easily
do by layering views.
My advice is to adhere as strictly as possible to the MVC model. Let your
Layers observe that they need and act accordingly, rather than trying to
actively control them. Then, if you want a second view of the same data (in
our case, a presentation screen), you can easily replicate an
identical-content view.
Another neat trick is to use a centralized invalidation rect, which relevant
screens can observe. That way, when you change one screen, the others
immediately track the changes.
On 1/7/15 1:39 PM, "email@hidden"
<email@hidden> wrote:
> 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.).
_______________________________________________
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