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" <r...@rols.org> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
> 
> This email sent to luket...@apple.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to