Coordinating animation of layers with a UIView animation
Coordinating animation of layers with a UIView animation
- Subject: Coordinating animation of layers with a UIView animation
- From: Roland King <email@hidden>
- Date: Tue, 06 Nov 2012 21:09:24 +0800
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