将repeatCount设置为1e100f会发出警告
来自 Apple 文档:
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
我做错了什么?
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;
Xcode 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 HUGE_VALF (我认为是 1e50f,但使用常量)。查找 repeatCount 告诉我们:
Try using HUGE_VALF (which I think is 1e50f, but use the constant) instead. Looking up repeatCount tells us:
更改 flicker.repeatCount = 1e100f;
到
闪烁.repeatCount = 1e100;
change flicker.repeatCount = 1e100f;
to
flicker.repeatCount = 1e100;