2011-03-21 47 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]; 


    } 
}