2

Does anyone knows how to get that "sequential" drop effect? I used this answer's code but that animates ALL annotations at once. The pins don't drop one at a time like the standard drop animation used with MKPinAnnotation items.

I also tried to add a call to [UIView setAnimationDelay:offset] but that just delays the entire block animation.

Any thoughts on this will be appreciated.

Community
  • 1
  • 1
TeodorC
  • 73
  • 1
  • 9

1 Answers1

0

this may help you get started

- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
    static BOOL seeded = NO;
    if(!seeded)
    {
        seeded = YES;
        srandom(time(NULL));
    }

    MKAnnotationView *aV;
    for (aV in views) {
        if([aV isKindOfClass:[MKUserLocation class]]) continue;

        CGRect endFrame = aV.frame;

        aV.frame = CGRectMake(aV.frame.origin.x, aV.frame.origin.y, aV.frame.size.width/2, aV.frame.size.height/2);

        [UIView beginAnimations:nil context:NULL];

        CGFloat randTime = (CGFloat) random()/(CGFloat) RAND_MAX;
        [UIView setAnimationDuration:randTime];
        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
        [aV setFrame:endFrame];
        [UIView commitAnimations];


    }
}
johndpope
  • 5,035
  • 2
  • 41
  • 43