我在手表套件中使用 animateImageWithImages 动画,但是没有属性可以检查动画是否完成,这与 iPhone 不同,我们可以将它放在块中或可以使用 isAnimating 属性进行检查。我们如何知道何时停止手表套件中的动画?
1 回答
1
我正在使用 WKInterfaceImage 制作动画。例如,您有一个动画持续时间为 2 秒的 WKInterfaceImage。因此您可以使用如下延迟功能在 2 秒后开始和停止动画:
self.animateImage.startAnimating()//Start animate the image
//delay function in 2 seconds, after 2 seconds and we will stop the animated image
dispatch_after(dispatch_time(
DISPATCH_TIME_NOW,
Int64(2 * Double(NSEC_PER_SEC))
), dispatch_get_main_queue(), { () -> Void in
self.animateImage.stopAnimating()
//you can write some function in here after finish the anim
})
于 2015-02-02T06:45:13.120 回答