gpt4 book ai didi

ios - WatchKit 图像动画等待完成

转载 作者:搜寻专家 更新时间:2023-11-01 06:23:19 24 4
gpt4 key购买 nike

我目前正在寻找一种方法来等待完成我的图像动画,然后在完成后开始下一个。

我想使用完成处理程序,但它“对我不起作用”,在这种情况下有没有办法使用它?

if X > 1 {
self.GroupIMG.setBackgroundImageNamed("single")
self.GroupIMG.startAnimatingWithImagesInRange(NSRange(location: 0, length: 300), duration: Repeater, repeatCount: self.X)

}



//this should start after the if is done

self.GroupIMG.setBackgroundImageNamed("single")
self.GroupIMG.startAnimatingWithImagesInRange(NSRange(location: 0, length: leftX), duration: Repeater, repeatCount: 1)

最佳答案

您必须创建一个与动画持续时间相同的计时器,并等待计时器触发以了解 WatchKit 动画何时结束。

这是 Apple 在 Apple 开发者论坛上对这个问题的回应。

There is not a way to currently know when an animation has ended, as we haven't exposed a completion handler in WatchKit's API. Please file an enhancement request at http://bugreport.apple.com if you'd like to see something added. Past that, you can use the method described, just be aware that it may not work as you like under all circumstances. You may choose to alter your UI if you need need it to always be spot on.

您可以在此处阅读完整主题 https://devforums.apple.com/message/1087798#1087798 .基本上,使用计时器并不完美,但它是您所拥有的最好的。

关于ios - WatchKit 图像动画等待完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29498214/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com