CABasicAnimation 无限重复而不使用 HUGE_VALF?
我正在尝试使用 CABasicAnimation 执行图像旋转动画的自动重复。我试图在网上搜索如何设置此类属性,但无法找到。 CA动画真的没有这个属性吗?我知道您可以设置一些巨大的值(这里)重复计数属性,但是嘿,为什么 UIView animateWithDuration 有一个选项 UIViewAnimationOptionRepeat 以及硬编码的值是什么?
I'm trying to perform auto repeat of my image rotation animation with CABasicAnimation. I have tried to search on web how to set such property but was unable to find that. Is it really no such property for CA animation? I know that you can set some huge value (here) to repeatCount property but hey, why then does UIView animateWithDuration has an option UIViewAnimationOptionRepeat and what the value is hardcoded for it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,这是您应该按照 文档。
Swift 更新:
HUGE_VALF 未向 Swift 公开。然而,我从此页面的理解是 HUGE_VALF 应该是无穷大(事实上,< code>INFINITY 定义为
HUGE_VALF
)。由于 Swift 的FloatingPointType
协议提供了static var infinity
,因此您可以简单地编写No, this is the way you're supposed to do it according to the documentation.
Update for Swift:
HUGE_VALF is not exposed to Swift. However, my understanding from this page is that HUGE_VALF is intended to be infinity (in fact,
INFINITY
is defined asHUGE_VALF
). Since Swift'sFloatingPointType
protocol provides astatic var infinity
, you can simply write