开发者

Setting repeatCount to 1e100f gives a warning

开发者 https://www.devze.com 2023-04-04 12:53 出处:网络
From Apple Documentation: Setting the repeatCount to 1e100f will cause the animation to repeat until it is removed from the layer.

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;

0

精彩评论

暂无评论...
验证码 换一张
取 消