Re: Coordinating animation of layers with a UIView animation
Re: Coordinating animation of layers with a UIView animation
- Subject: Re: Coordinating animation of layers with a UIView animation
- From: Luke Hiesterman <email@hidden>
- Date: Tue, 06 Nov 2012 13:40:44 +0000
- Thread-topic: Coordinating animation of layers with a UIView animation
After setting up your UIView animation, you can introspect the animation timing by looking at the respective view's layer.animations. Your can then apply that animation to your sublayer.
For bonus points, just start using a subview instead of a sublayer :)
Luke
On Nov 6, 2012, at 5:09 AM, "Roland King" <email@hidden> wrote:
> I have a UIView which frame I am animating to a new location/size using [ UIView animateWithDuration:animations ]. The view's layer has a custom sublayer which it's laying out either in layoutSubviews or layoutSublayersOfLayer:, either seems to work. That sublayer is also moving to a new position depending on the new UIView bounds. What I want is the two animations to go together, using whatever the duration set in the UIView's animateWithDuration:animations: call because that is the point at which I know how long the animation needs to be.
>
> The only way I've found to do this so far seems really hacky, to nest a CATransaction within the UIView animation and give them the same time, is there a better way to accomplish something like this?
>
> NSTimeInterval interval = 2f;
>
> [ UIView animateWithDuration:interval animations:^{
> [ CATransaction begin ];
> [ CATransaction setAnimationDuration:interval ];
> self.faceView.frame=faceViewFrame;
> [ CATransaction commit ];
> } ];
>
> _______________________________________________
>
> 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