Re: Using Core Animation to animate view properties?
Re: Using Core Animation to animate view properties?
- Subject: Re: Using Core Animation to animate view properties?
- From: Jonathan Dann <email@hidden>
- Date: Thu, 23 Oct 2008 13:28:57 +0200
Hi Jim,
I've been having major problems with working with non-layer-baked
views to coordinate the animation of their positions. Some of the
caveats I've come across (note that I haven't used -setWantsLayer: on
any of the views as it's unnecessary for animating the frame of an
NSView with the -animator proxy):
1) Using -setWantsLayer: on a custom view can cause problems if you
set it to YES in -initWithFrame: and then later create the view in IB,
which by default sets it to NO after -initWithFrame: and just before
you get an -awakeFromNib.
2) If you call [[self animator] setFrame:newFrame]; and then ask the
view for it's frame, you DON'T get the toValue as one would be used to
after using CALayers. This makes co-ordination of views very
difficult. The value you get is the fromValue.
3) From what I've found, calling [[self animationForKey:@"frameOrigin/
Size"] setDelegate:self]; will cause you to receive -
animationDidStop:finished: calls from a *bunch* of CABasicAnimation
objects, none of which are the same object you got from -
animationForKey:.
3)a) As soon as you set viewA as the delegate of an animation, and
then do the same for viewB, viewA will no longer get the delegate calls.
5) I haven't found a way to detect an in-flight animation, if you
solve it, please let me know as it would make life a lot easier for me.
If you (or anyone else) disagrees with me on these points, I'd love to
hear from you. I've been battling with this for a while now.
Jonathan
http://espresso-served-here.com
On 22 Oct 2008, at 20:13, Jim Correia wrote:
On Oct 22, 2008, at 12:54 PM, Matt Long wrote:
1. If you want to know whether an animation is still running, just
check to see if it is still in the animations dictionary in the
layer. A call like this would do it:
[...]
How you apply this to view properties, I'm not sure, but this is
how you do these things with layers. Hope that helps.
I'm trying to animation a non-layer *view* property. My view isn't
actually layer backed.
I'm still curious how to detect an in-flight animation.
The documentation suggests I can abort the in-flight animation by
setting the target value inside of a zero duration animation
context. This isn't working in my sample app. After I review the
code, I'll post a link to it here.
Jim
_______________________________________________
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
_______________________________________________
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