• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sage advice (NSView vs. CALayer)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sage advice (NSView vs. CALayer)


  • Subject: Re: Sage advice (NSView vs. CALayer)
  • From: Alex Kac <email@hidden>
  • Date: Tue, 28 Oct 2008 21:05:51 -0500

That's a great one. So in a way if I'm creating a user inter-actable view, I could do my drawing in the layer, but handle all my user interaction in the view. Does that sounds about right? Again I haven't gotten that deep yet, but am working on a few things that I will be...

On Oct 28, 2008, at 6:46 PM, John Pannell wrote:

Hi Alex-

One difference comes to mind, and is of substance for app design:

- NSView is a subclass of NSResponder, CALayer is not.

So views are happy to field click and keyboard events for you, participate in the responder chain, handle mouse drag/enter/exit, etc. I believe a common design is to have the NSView be layer- backed and "host" your layer tree. The layers are so fantastically lightweight they can do amazing drawing and animation, but part of the weight they lost was the ability to field events. Use the host view to do this, then pass the location of the event to the root CALayer's hitTest: method to determine what was clicked on.

I'm sure there are many other differences that could be highlighted, but that one stands out for me!

John


Positive Spin Media http://www.positivespinmedia.com

On Oct 28, 2008, at 3:43 PM, Alex Kac wrote:

One question I have that maybe this list can help me understand. If you have views that are layer backed - why would one use any of the view methods instead of the layer methods? I have to admit in some ways I am somewhat perplexed why a CALayer doesn't replace the view itself completely. This is an area I have not yet had to delve into in the docs too much there, but what I have read it doesn't really explain much about the perceived dichotomy.

I would love an eye-opener description here :) And for me its a Leopard/iPhone only world if that makes a difference.

On Oct 28, 2008, at 4:35 PM, DKJ wrote:

When I was but a newbie,
I heard a wise man say,
"When using CALayers,
Put NSViews away."

Yet I set a CALayer,
Then added NSView;
Now many hours later,
I wail, "T'is true, t'is true!"
_______________________________________________

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

Alex Kac - President and Founder Web Information Solutions, Inc.

"There will always be death and taxes; however, death doesn't get worse every year."
-- Anonymous





_______________________________________________

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


Alex Kac - President and Founder Web Information Solutions, Inc.

“Don't forget until too late that the business of life is not business but living.”
-- B.C. Forbes,





_______________________________________________

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


  • Follow-Ups:
    • Re: Sage advice (NSView vs. CALayer)
      • From: Scott Anguish <email@hidden>
References: 
 >Sage advice (From: DKJ <email@hidden>)
 >Re: Sage advice (From: Alex Kac <email@hidden>)
 >Re: Sage advice (NSView vs. CALayer) (From: John Pannell <email@hidden>)

  • Prev by Date: Re: Message Forwarding Overhead / Performance
  • Next by Date: Re: Sage advice
  • Previous by thread: Re: Sage advice (NSView vs. CALayer)
  • Next by thread: Re: Sage advice (NSView vs. CALayer)
  • Index(es):
    • Date
    • Thread