Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override "selected state" image in MKAnnotationView?

I've got annotation views with custom pin images on a map. When I tap and hold on a pin, my custom image disappears and is replaced by the default red pin. This default image appears in its selected (highlighted) state (it looks slightly darker). How can I prevent the selected state image from replacing my custom image?

Many thanks.

like image 904
cravr Avatar asked Nov 19 '25 21:11

cravr


1 Answers

Found the solution: I was incorrectly using the class MKPinAnnotationView instead of MKAnnotationView for my annotations. When the custom pin was tapped, causing it to darken (in its highlight state), the custom image was being replaced by the default pin that underlines MKPinAnnotationView.

like image 193
cravr Avatar answered Nov 22 '25 14:11

cravr