how can I detect the completion of an animation triggered by CATransaction

陌路散爱 提交于 2019-12-01 05:34:59
barley

According to the doc, [CATransaction setCompletionBlock:] could be used for what you want.

It says

The completion block object is guaranteed to be called (on the main thread) as soon as all animations subsequently added by this transaction group have completed (or have been removed.) If no animations are added before the current transaction group is committed (or the completion block is set to a different value,) the block will be invoked immediately.

Try adding something like this before you begin the animation transaction.

[CATransaction setCompletionBlock:^{
    // Action after the animation completion
}];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!