我想使用给定的 CAAnimation
为 UIView
制作动画,并在动画播放时与 View 交互(该 View 具有手势识别器)。
如果我理解正确的话,CAAnimation
只会为 View 层设置动画,但 View 本身将保持在原来的位置。
如何使 UIView
随 CAAnimation
一起移动?
最佳答案
如果您只关心视觉“粘性”,您可以这样做:
[myAnimation setRemovedOnCompletion:NO];
但这只是视觉上的。它不会更改实际图层的属性。
如果您希望图层的属性也更新为新值,您可以执行以下操作:
// 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]];
关于iphone - 在制作动画时应用 CAAnimation 的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9702351/