0

I'm trying to add an animation below the annotations of my MKMapView but with no luck. I tryed to change the CAShapeLayer zPosition but the circle end up below the map. Here is my current code to add the animation to the map:

int radius = 55;
CAShapeLayer *circle = [CAShapeLayer layer];

circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius)
                                         cornerRadius:radius].CGPath;

circle.position = CGPointMake(CGRectGetMidX(self.view.frame)-radius,
                              CGRectGetMidY(self.view.frame)-radius);

circle.fillColor = [UIColor clearColor].CGColor;
circle.strokeColor = [UIColor blackColor].CGColor;
circle.lineWidth = radius*2;
circle.opacity = 0.5;

[self.mapView.layer addSublayer:circle];

CABasicAnimation *drawAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
drawAnimation.duration            = 2.5; // "animate over 10 seconds or so.."
drawAnimation.repeatCount         = 100.0;  // Animate only once..
drawAnimation.removedOnCompletion = YES;   // Remain stroked after the animation..

drawAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
drawAnimation.toValue   = [NSNumber numberWithFloat:1.0f];

functionWithName:kCAMediaTimingFunctionEaseIn];

[circle addAnimation:drawAnimation forKey:@"drawCircleAnimation"];
decomush
  • 156
  • 1
  • 8

1 Answers1

0

After 3 days without an answer I decided to remove my annotation from the mkview and put the animation and the image corresponding to the annotation in another view, above the map.

decomush
  • 156
  • 1
  • 8