1

I'm having a strange issue with the initial set of pins not showing the custom image.

In my

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation 

Method I set the image as follows:

pushPin.image = [UIImage imageNamed:@"shopping_map_pin"];

However, for the first set of pins, this image is not being set. If I set the pin color in the same method, that is applied but not the image.

What is causing this?

James
  • 6,471
  • 11
  • 59
  • 86
  • Are u able to post your full code in viewForAnnotation? – Ken Toh Oct 28 '12 at 06:49
  • Sounds like you're creating MKPinAnnotationViews instead of MKAnnotationViews. See http://stackoverflow.com/q/9814988/467105. –  Oct 28 '12 at 20:15

1 Answers1

1

The issue was that yes, I was using MKPinAnnotationView instead of MKAnnotationView. MKAnnotationView is more generic and allows for custom images to be loaded. That being said, it seems that when a view is recycled, an MKPinAnnotationView will use the image it was initially assigned.

James
  • 6,471
  • 11
  • 59
  • 86