2014-02-27 115 views
-2

如何沿着路径动画制作UIImageView?如何沿着路径制作动画

有没有人知道任何教程通过这个?

+1

您是否尝试过在线查找?请展示一些研究工作。 –

+0

欢迎来到StackOverflow!这里最好的问题是关于代码,你尝试过什么以及你做了什么努力。做一些研究,然后问一个具体的问题。 –

+0

我是如何使用关键帧动画来做到这一点 – user3349248

回答

0

CAKayframeAnimation可以这样做。

CGMutablePathRef path = CGPathCreateMutable(); 
//your code to configure the path 

//configure the animation 
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 
[animation setPath:path]; 
[animation setDuration:3.0]; 
CGPathRelease(path); 
[self.yourImageView.layer addAnimation:animation forKey:NULL]; 
+0

有没有什么关于动画的.h文件 – user3349248

+0

什么需要,但你可以将你的imageView作为一个属性添加到viewController – Jing

+0

这是一个UIView子类吗? – user3349248