animateWithDuration的“枚举类型的隐式转换”

时间:2013-10-01 23:52:59

标签: objective-c uiview enums implicit-conversion animatewithduration

尝试在UIView制作动画时,它表示“从枚举类型隐式转换”

我的代码是:

[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationCurveEaseIn animations:^{
    [pea setFrame:CGRectMake(82, 224, 35, 35)];
} completion:^(BOOL finished){}];

只是想知道如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

UIViewAnimationCurveEaseIn不是animateWithDuration方法的有效值。您可能想要UIViewAnimationOptionCurveEaseIn(注意常量名称中的Option)。

请参阅UIViewAnimationOptions,了解与animateWithDuration一起使用的值列表。你使用的那个常数是用于不同的方法。

因此:

[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
    [pea setFrame:CGRectMake(82, 224, 35, 35)];
} completion:NULL];