Apply CAAnimation changes during animation

I want to animate UIView

with a given CAAnimation

and interact with a view while animating it (the view has a gesture recognizer).

If I understand correctly, it will CAAnimation

only animate the view layer, but the view itself will remain in its original position.

How do I UIView

move using CAAnimation



source to share

2 answers

If you only care about visual "stickiness", you can do:

[myAnimation setRemovedOnCompletion:NO];


But this is only visually. It does not change the actual properties of the layer.

If you want the layer properties to update to the new values ​​as well, you can do something like:

// You have code above that to register the property you want to animate...
[myAnimation setFromValue:[NSNumber numberWithFloat:0.0f]];
[myAnimation setToValue:[NSNumber numberWithFloat:1.0f]];




Instead of trying to move it, you can expand yours UIView

to cover the area you want the strokes to and then animate it layer

inside of it. Remember to set the view property to a opaque

value NO

You might want to add sublayer

to view.layer

, rather than move, your own view layer, for example if you want the layer to go outside of the view without affecting the layout of the view's subzones.



All Articles