Ios 贴图盒动画添加或删除图层

Ios 贴图盒动画添加或删除图层,ios,animation,mapbox,rmannotation,Ios,Animation,Mapbox,Rmannotation,我可以为向贴图框mapView添加符号设置动画: - (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation{ //create a new annotation marker RMMarker *marker = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"pin"]]; marker.anchorPoin

我可以为向贴图框mapView添加符号设置动画:

- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation{
//create a new annotation marker
RMMarker *marker = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"pin"]];
marker.anchorPoint = CGPointMake(0.5, 1);

RestaurantAnnotation *restAnnotation = (RestaurantAnnotation *)annotation;
CLLocationCoordinate2D actualCoordinate = restAnnotation.coordinate;
CLLocationCoordinate2D containerCoordinate = restAnnotation.clusterAnnotation.coordinate;

[CATransaction begin];
[CATransaction setAnimationDuration:0.30];
[CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

CABasicAnimation *spreadOutAnimation = [CABasicAnimation animationWithKeyPath:@"position"];

spreadOutAnimation.fromValue = [NSValue valueWithCGPoint:[self.mapView coordinateToPixel:containerCoordinate]];
spreadOutAnimation.toValue   = [NSValue valueWithCGPoint:[self.mapView coordinateToPixel:actualCoordinate]];

[marker addAnimation:spreadOutAnimation forKey:@"spreadOut"];

[CATransaction commit];}
但是我在从Mapbox mapView中设置动画时遇到了一个问题。在下面的委托方法中,我尝试设置
注释的动画。层
扩散到集群中,但
注释。层
突然变为零,并且
注释。层
从地图中删除。所以没有动画发生

- (void)mapView:(RMMapView *)mapView willHideLayerForAnnotation:(RMAnnotation *)annotation
你的想法是什么?如何设置已删除对象的动画