Reputation: 55
I have something like 30 annotations in my map and I want speed up the dropping animation.
Is it possible speed up the drop of annotation in MKMapView or drop all of them at once?
Upvotes: 1
Views: 1214
Reputation:
You'll need to implement your own drop animation in the didAddAnnotationViews
delegate method. You should also set animatesDrop
to NO
to avoid a possible double animation.
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)annotationViews
{
NSTimeInterval delayInterval = 0;
for (MKAnnotationView *annView in annotationViews)
{
CGRect endFrame = annView.frame;
annView.frame = CGRectOffset(endFrame, 0, -500);
[UIView animateWithDuration:0.125
delay:delayInterval
options:UIViewAnimationOptionAllowUserInteraction
animations:^{ annView.frame = endFrame; }
completion:NULL];
delayInterval += 0.0625;
}
}
This drops the annotations at a rate you specify.
To drop them all at once, hard-code the delay
parameter to 0.0
instead of the incrementing delayInterval
.
Upvotes: 1