"Implicit conversion from enumeration type" for animateWithDuration



当尝试用UIView制作动画时,它说"枚举类型的隐式转换"

我的代码是:

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

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

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

有关要与animateWithDuration一起使用的值的列表,请参阅UIViewAnimationOptions。您使用的常量旨在与其他方法一起使用。

因此:

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

最新更新