Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cast of 'int' to 'CAMediaTimingFunction *' is disallowed with ARC

Can anyone please suggest alternative to this line of code so that my code becomes compatible with ARC.

[animation setTimingFunction:(CAMediaTimingFunction*)UIViewAnimationCurveEaseInOut];
like image 761
CKK Avatar asked Dec 03 '22 06:12

CKK


1 Answers

That code isn't correct even in MRR (non-ARC). The only reason it's not crashing is because UIViewAnimationCurveEaseInOut happens to have the value of 0 (which becomes nil after the cast).

Instead you should be using

[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

This will do what you're intending to do, except with an actual instance of CAMediaTimingFunction*.

like image 149
Lily Ballard Avatar answered Dec 24 '22 19:12

Lily Ballard