0

當試圖使動畫在UIView它說「從枚舉類型的隱式轉換」爲animateWithDuration

我的代碼是「從枚舉類型的隱式轉換」:

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

只是想知道我該如何解決這個?

回答

2

UIViewAnimationCurveEaseIn對於animateWithDuration方法不是有效值。你大概打算UIViewAnimationOptionCurveEaseIn(注意在常數名稱Option)。

有關與animateWithDuration一起使用的值列表,請參見UIViewAnimationOptions。你用過的這個常量是用於不同的方法。

因此:

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