我正在为以下 UIView 动画寻找等效的核心动画?
[UIView animateWithDuration:0.25 animations:^(void) {
cell.frame = newCellFrame;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.25 animation:^(void) {
cell.frame = finalCellFrame;
}];
}];
我特别想知道的是你是如何用核心动画来模拟这个动画的“完成”部分的。是使用核心动画委托(delegate)的唯一选择还是有像上述代码片段一样优雅的解决方案?
最佳答案
在 CoreAnimation 中,它是通过委托(delegate)完成的。您可以在您的 CAAnimation/CABasicAnimation 实例上设置一个委托(delegate),动画将向您发出 animationDidStart:
和 animationDidStop:finished:
回调。
关于cocoa-touch - 内置 UIView 动画的核心动画等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6233470/