1

アップルのドキュメントから:

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

私が間違っていることはありますか?

4

2 に答える 2

10

代わりにHUGE_VALF(1e50fだと思いますが、定数を使用してください)を使用してみてください。repeatCountを検索すると、次のことがわかります。

このプロパティをHUGE_VALFに設定すると、アニメーションが永久に繰り返されます。

于 2011-09-14T06:57:30.947 に答える
1

flicker.repeatCount = 1e100f; を変更します。flicker.repeatCount = 1e100; に

于 2013-05-09T09:20:33.590 に答える