如果你的目標的iOS4,塊來處理動畫,而無需擔心代表,回調,或選擇一個偉大的方式:
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
if ([views count] == 0) {
return;
}
MKAnnotationView *aV;
for (aV in views) {
// set up pin beginning and end frames, shadow subview frame and center
[UIView animateWithDuration:0.75
delay:(0.0 + [views indexOfObject:aV]/10.0)
options:UIViewAnimationOptionCurveEaseOut
animations:^{
[aV setFrame:endFrame];
// animate the shadow subview's center point
}
completion:^ (BOOL finished) {
if (finished) {
// do something here when the animation finished
}
}];
}
這將是巨大的,有一個iOS的3兼容的解決方案。 – samvermette 2010-10-06 17:37:19