Search code examples
objective-cuiviewenumsimplicit-conversionanimatewithduration

"Implicit conversion from enumeration type" for animateWithDuration


When trying to make an animation in UIView it says 'implicit conversion from enumeration type'

My code is:

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

Just wondering how I can fix this?


Solution

  • UIViewAnimationCurveEaseIn is not a valid value for the animateWithDuration method. You presumably intended UIViewAnimationOptionCurveEaseIn (note the Option in the constant name).

    See UIViewAnimationOptions for a list of values to be used in conjunction with animateWithDuration. That constant you've used is intended for use with a different method.

    Thus:

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