Reading a post by Brad Larson, I ended up with a nice feature to make my image the next round.
You need to import the QuartzCore framework: #import
Here is the code:
// Set up path movement CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; pathAnimation.calculationMode = kCAAnimationPaced; pathAnimation.fillMode = kCAFillModeForwards; pathAnimation.removedOnCompletion = NO; pathAnimation.repeatCount = INFINITY; //pathAnimation.rotationMode = @"auto"; pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; pathAnimation.duration = 5.0; // Create a circle path CGMutablePathRef curvedPath = CGPathCreateMutable(); CGRect circleContainer = CGRectMake(0, 0, 400, 400); // create a circle from this square, it could be the frame of an UIView CGPathAddEllipseInRect(curvedPath, NULL, circleContainer); pathAnimation.path = curvedPath; CGPathRelease(curvedPath); [self.imageView.layer addAnimation:pathAnimation forKey:@"myCircleAnimation"];
source share