title: Wrong image MKAnnotationView after refreshed the map
body: <p>I have a mapview hundreds of annotations. I load annotations in background, and when all annotations are loaded, I call the method: setAnnotations.</p>
  
  <p>I have 6 types of annotations with different pin for each other.</p>
  
  <p>It works well for the first loading. But if I want to refresh the map (because I use a filter), the pin image change.</p>
  
  <p>I saw a similar issue <a href="https://stackoverflow.com/questions/13291201/problems-with-mapview-pin-annotation-pin-loses-color-when-map-is-zoomed-panned%22Here%22">Here</a>, but it seems not working for me.</p>
  
  <p>Here my viewForAnnotation method:</p>
  
  <pre><code>//... 
  else if ([annotation isKindOfClass:[CustomAnnotation class]]) {
  
          CustomAnnotation *singleAnnotation = (CustomAnnotation *)annotation;
          annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"singleAnnotationView"];
  
          if (!annotationView) {
              annotationView = [[MKAnnotationView alloc] initWithAnnotation:singleAnnotation reuseIdentifier:@"singleAnnotationView"];
              annotationView.canShowCallout = YES;
              annotationView.centerOffset = CGPointMake(0, -20);
              annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
          }
          else
              annotationView.annotation = annotation;
  
  // Solution, put it here:
  annotationView.image = [UIImage imageNamed:[NSString stringWithFormat:@"pin_%d", singleAnnotation.idType]];
      } 
  //...
  </code></pre>
  
  <p>And here my method I call to load and reload the map:</p>
  
  <pre><code>- (void)loadMapView
  {
      UIActivityIndicatorView *a = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
      self.mapview.hidden = YES;
      a.center = CGPointMake(160, 240);
      [self.view addSubview:a];
      [a startAnimating];
  
      NSMutableArray *array = [NSMutableArray new];
  
      if(self.mapview.annotations.count &gt; 0){
          [self.mapview removeAnnotations:self.mapview.annotations];
          [self.mapview removeOverlays:self.mapview.overlays];
      }
  
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
  
          for(MapObjects *obj in [MapRepository shared].repository){
  
              CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(obj.coord_geo_latitude,obj.coord_geo_longitude);
  
              CustomAnnotation *annotation = [[CustomAnnotation alloc] initWithCoordinates:coordinate
                                                                                 placeName:obj.placeName
                                                                               description:obj.description
  idType:obj.idType];
  
              if(annotation.coordinate.latitude != 0 || annotation.coordinate.longitude != 0)
                  [array addObject:annotation];
          }
  
          dispatch_async(dispatch_get_main_queue(), ^{
  
              [self.mapview addAnnotations:array];
              [self.mapview zoomToFitMapAnnotations:self.mapview];
              [a stopAnimating];
              self.mapview.hidden = NO;
          });
      });  
  }
  </code></pre>
  
  <p>What I'm doing wrong ? </p>
  
  <p>Any suggestions and help are appreciate. 
  Thank you in advance ;)</p>