例如,@(...)是什么意思?
CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[rotate setToValue:@(M_PI)];
[rotate setDuration:0.1f];
[[aView layer] addAnimation:rotate forKey:@"myRotationAnimation"];
其中M_PI
被定义为在math.h
一个宏,
#define M_PI 3.14159265358979323846264338327950288 /* pi */
@(M_PI)是一个NSNumber的在这种情况下 – johnMa
@johnMa事实上,@前缀(表达),其中@后跟圆括号中,将永远是一个数吧?方括号=数组,花括号=字典。 –