From Apple Documentation:
Setting the repeatCount to 1e100f will cause the animation to repeat until it is removed from the layer.
Here's my code:
CABasicAnimation *flicker = [CABasicAnimation animationWithKeyPath:@"opacity"];
flicker.repeatCount = 1e100f;
X开发者_运维百科code gives a warning:
Semantic Issue: Magnitude of floating-point constant too large for type 'float'; maximum is 1.7014116E+38
Something I'm doing wrong?
Try using HUGE_VALF (which I think is 1e50f, but use the constant) instead. Looking up repeatCount tells us:
Setting this property to HUGE_VALF will cause the animation to repeat forever.
change flicker.repeatCount = 1e100f; to flicker.repeatCount = 1e100;
精彩评论