It seems to me there are generally 2 ways to add animation to the NSView or its derived view classes. One way is to add the animation to the proxy of the frame, another way i开发者_开发知识库s to add it to CALayer directly.
What should be the best practice? Is there any difference between these 2 approaches? And in the first approach, is it true the proxy also configures the animation to the CALayer behind the scene so this 2 ways are actually equivalent?
Thanks in advance!
If you're using a layer-backed NSView
then you should normally use the animator proxy. This will indeed animate the backing layer as well as the view itself.
If you just animate the layer, the view itself will stay in its original location but its representation is moved on-screen. This is very rarely what you want.
I would recommend only animating CALayer
objects that you specifically create, not the implicit layer of layer-backed NSView
s.
精彩评论