来自 Apple 文档pausesoncompletion
因为当此属性为 true 时不会调用完成处理程序,所以您不能使用动画制作者的完成处理程序来确定动画何时完成运行。相反,您可以通过观察 isRunning 属性来确定动画何时结束。
但我发现观察isRunning
不起作用。util i wathched WWDC 2017 - Session 230-Advanced Animations with UIKit,我知道我应该观察running
//not work
animator.addObserver(self, forKeyPath: "isRunning", options: [.new], context: nil)
//this work
animator.addObserver(self, forKeyPath: "running", options: [.new], context: nil)
我的问题是:我在哪里可以找到 excatly 密钥路径,不仅是这种情况。谢谢~