2011-03-21 58 views
2

有谁知道如何获得“顺序”放置效果?我使用这个answer's代码 ,但一次动画所有注释。引脚不会像MKPinAnnotation项目中使用的标准放置动画一样一次放下一个。MKAnnotations自定义引脚放置动画

我也尝试添加一个电话给[UIView setAnimationDelay:offset],但这只是延迟整个块动画。

对此的任何想法将不胜感激。

回答

0

这可能会帮助你开始

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


    } 
}