CABasicAnimation无限重复没有HUGE_VALF? [英] CABasicAnimation unlimited repeat without HUGE_VALF?

查看:119
本文介绍了CABasicAnimation无限重复没有HUGE_VALF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CABasicAnimation自动重复我的图像旋转动画。我试图在网上搜索如何设置这样的属性,但无法找到。 CA动画真的没有这样的属性吗?我知道你可以设置一些巨大的价值(这里)到repeatCount属性,但是,为什么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?

推荐答案

不,这是按照文档


将此属性设置为 HUGE_VALF 将导致动画永远重复。

Setting this property to HUGE_VALF will cause the animation to repeat forever.






Swift更新:

HUGE_VALF未暴露给Swift。但是,我从此页面的理解是,HUGE_VALF旨在无限(事实上, INFINITY 定义为 HUGE_VALF )。由于Swift的 FloatingPointType 协议提供了 static var infinity ,因此您只需编写

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 as HUGE_VALF). Since Swift's FloatingPointType protocol provides a static var infinity, you can simply write

myAnimation.repeatCount = .infinity

这篇关于CABasicAnimation无限重复没有HUGE_VALF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆