美文网首页
8.实现自定义的大头针视图用天而降的效果

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

作者: 流沙3333 | 来源:发表于2017-03-10 14:45 被阅读11次

#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.实现自定义的大头针视图用天而降的效果

      本文链接:https://www.haomeiwen.com/subject/ifongttx.html