-2

How do I animate UIImageView along a path?

Does anyone know of any tutorials that walk through this?

3
  • 1
    Have you tried looking online? Please show some research effort.
    – Blue Ice
    Feb 27, 2014 at 1:50
  • Welcome to StackOverflow! The best questions here are about code, what you have tried and what effort you have made. Do some research and then ask a specific question.
    – Steve H.
    Feb 27, 2014 at 1:54
  • I was how you would use key frame animation to do this Feb 27, 2014 at 1:56

1 Answer 1

0

CAKayframeAnimation can do so.

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];
12
  • Is there anything needed in the .h file Feb 27, 2014 at 2:01
  • nothing about the animation, but you can add your imageView as a property to the viewController
    – Jing
    Feb 27, 2014 at 2:03
  • Would this be a UIView subclass? Feb 27, 2014 at 2:04
  • UIImageView, UIKit provides it
    – Jing
    Feb 27, 2014 at 2:05
  • is quartz core animation needed? And just to be sure this does not need to be in a UIView subclass. Feb 27, 2014 at 2:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.