知道 UIProgressView 何时停止动画

Knowing when a UIProgressView stops animating

UIProgressView 有这个 setProgress:animated: API.

有没有办法准确知道动画何时停止?

我的意思是这样的?

[myProgress setProgress:0.8f animated:YES onCompletion...]

我想在动画结束后立即开始淡出进度。

发件人:

当您不是动画的作者时,您可以使用事务完成块在动画结束时获得回调:

[CATransaction setCompletionBlock:^{
     // doSomethingElse
}];
// doSomething

来自Apple documentation

Discussion

The completion block object that 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.