当前位置: 动力学知识库 > 问答 > 编程问答 >

ipad - 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];

网友答案:

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*.

分享给朋友:
您可能感兴趣的文章:
随机阅读: