Iphone MKAnnotations的自定义针掉落动画

Iphone MKAnnotations的自定义针掉落动画,iphone,mapkit,mkmapview,mkannotation,Iphone,Mapkit,Mkmapview,Mkannotation,有人知道如何获得连续下降效应吗?我用了这个密码 但这会同时为所有注释设置动画。与MKPinAnnotation项使用的标准放置动画不同,管脚不会一次放置一个 我还尝试添加对[UIView setAnimationDelay:offset]的调用,但这只会延迟整个块动画 如果您对此有任何想法,我们将不胜感激 这可能会帮助您开始 - (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views { stat

有人知道如何获得连续下降效应吗?我用了这个密码 但这会同时为所有注释设置动画。与MKPinAnnotation项使用的标准放置动画不同,管脚不会一次放置一个

我还尝试添加对[UIView setAnimationDelay:offset]的调用,但这只会延迟整个块动画


如果您对此有任何想法,我们将不胜感激

这可能会帮助您开始

- (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];


    }
}

这可能会帮助你开始

- (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];


    }
}