8.实现自定义的大头针视图用天而降的效果

#pragma mark -当已经添加大头针视图后调用(还没有显示在地图上)该方法可以用来设置自定义动画--实现大头针视图用天而降的效果

-(void)mapView:(MKMapView*)mapView didAddAnnotationViews:(NSArray *)views{

for(MKAnnotationView*anvinviews) {

//排除定位的大头针

if([anv.annotation isKindOfClass:[MKUserLocation class]]) {

return;

}

CGRect targetRect = anv.frame;

//修改位置

anv.frame=CGRectMake(targetRect.origin.x,0, targetRect.size.width, targetRect.size.height);

[UIView animateWithDuration:0.3animations:^{

anv.frame= targetRect;

}];

}

}

你可能感兴趣的:(8.实现自定义的大头针视图用天而降的效果)