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
我做错了什么?
答案 0 :(得分:10)
尝试使用HUGE_VALF(我认为是1e50f,但使用常量)。查找repeatCount告诉我们:
将此属性设置为HUGE_VALF将导致动画永远重复。
答案 1 :(得分:1)
更改flicker.repeatCount = 1e100f; 至 flicker.repeatCount = 1e100;