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

前端 未结 1 1448
清酒与你
清酒与你 2021-01-13 11:36

I have a CALayer which I merely create and add to a subview of my view controller\'s main view in the controller\'s initWithNibName: And then, I perform the following animat

相关标签:
1条回答
  • 2021-01-13 12:20

    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
    }];
    
    0 讨论(0)
提交回复
热议问题