Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone MapKit: Annotation images get reset back to pins

I'm adding several annotations to a MapView and using a custom image instead of the default pins. I am using the viewForAnnotation delegate method to set the custom image like this:

view.image = [UIImage imageNamed:@"placemark.png"];

And I've also tried:

[(MKPinAnnotationView *)view setImage:[UIImage imageNamed:@"placemark.png"]];

Now, these both set the image just fine. But when an annotation is either tapped or the mapType changes to Satellite or Hybrid, it resets back to the red pin image. What am I missing?

like image 657
Kevin Cupp Avatar asked Nov 29 '22 19:11

Kevin Cupp


1 Answers

Don't use MKPinAnnotationView - just use MKAnnotationView.

like image 110
Bill Avatar answered Dec 26 '22 09:12

Bill