Apple Documentation:

Setting the repeatCount to 1e100f will cause the animation to repeat until it is removed from the layer.

这是我的代码:
CABasicAnimation *flicker = [CABasicAnimation animationWithKeyPath:@"opacity"];
flicker.repeatCount = 1e100f;

Xcode发出警告:
Semantic Issue: Magnitude of floating-point constant too large for type 'float'; maximum is 1.7014116E+38

我做错了什么?

最佳答案

尝试使用HUGE_VALF(我认为是1e50f,但使用常量)。查找repeatCount会告诉我们:

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

关于ios - 将repeatCount设置为1e100f会发出警告,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7410963/

10-10 21:05