iOS Mapkit – 注解在地图滚动/缩放中消失

在初始加载时,注释显示得很好。 但是,如果我滚动地图,它们都消失了,代码只被调用用户位置,而不是viewForAnnotation委托方法中的其他注释。

绘制引脚

-(void)viewDidLoad{ ...Download Coordinates and Data from Web here... [self.mapView addAnnotation:pin]; } 

委托方法

 - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { //Player's Pin if([annotation class] == MKUserLocation.class) { return nil; } //Cluster Pin if([annotation isKindOfClass:[REVClusterPin class]]){ REVClusterPin *pin = (REVClusterPin *)annotation; if( [pin nodeCount] > 0 ){ pin.title = @"___"; MKAnnotationView *annotationView = (REVClusterAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:@"cluster"]; if( !annotationView ){ annotationView = (REVClusterAnnotationView*) [[REVClusterAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"cluster"]; } annotationView.image = [UIImage imageNamed:@"cluster.png"]; [(REVClusterAnnotationView*)annotationView setClusterText: [NSString stringWithFormat:@"%i",[pin nodeCount]]]; annotationView.canShowCallout = NO; return annotationView; } } //Player Pin if([annotation isKindOfClass:[ZEPointAnnotation class]]){ ZEPointAnnotation *pin = (ZEPointAnnotation *)annotation; MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"pin"]; if(!annotationView){ annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin"]; } annotationView.canShowCallout = YES; annotationView.draggable = NO; ...Create Pin Data Here... return annotationView; } return nil; } 

删除animation。 这将解决你的问题