Ios 如何在MapView上一次放置500个接点
我有大约500个引脚,我想显示在MKMapView上 然而,当我调用Ios 如何在MapView上一次放置500个接点,ios,swift,Ios,Swift,我有大约500个引脚,我想显示在MKMapView上 然而,当我调用mapView.addAnnotations(places)(places是MKAnnotation对象的数组)时,引脚一个接一个地慢慢下降 我想: 加载时,立即放下所有销 完全取消拖放动画 这可能吗?您应该将MKAnnotationViews的animatesDrop属性设置为NO(false)通过将animation属性设置为NO,将立即在MapView上删除所有管脚 MKAnnotationView *annotati
mapView.addAnnotations(places)
(places
是MKAnnotation对象的数组)时,引脚一个接一个地慢慢下降
我想:
- 加载时,立即放下所有销
- 完全取消拖放动画
这可能吗?您应该将
MKAnnotationViews
的animatesDrop
属性设置为NO(false)通过将animation属性设置为NO,将立即在MapView上删除所有管脚
MKAnnotationView *annotationView =[[MKAnnotationView alloc]init];
annotationView.animatesDrop=FALSE;
您需要在didAddAnnotationViews委托方法中实现自己的拖放动画。还应将animatesDrop设置为“否”,以避免可能出现的双重动画
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)annotationViews
{
NSTimeInterval delayInterval = 0;
for (MKAnnotationView *annView in annotationViews)
{
CGRect endFrame = annView.frame;
annView.frame = CGRectOffset(endFrame, 0, -500);
[UIView animateWithDuration:0.125
delay:delayInterval
options:UIViewAnimationOptionAllowUserInteraction
animations:^{ annView.frame = endFrame; }
completion:NULL];
delayInterval += 0.0625;
}
}
谢谢如果它可以帮助其他人,则必须在mapView:viewForAnnotation:
delegate方法中完成此操作。