How to override the "selected state" image in MKAnnotationView?

I have annotations with custom images on the map. When I click and hold the pin, my custom image disappears and is replaced with a red default pin. This image appears by default in the selected (selected) state (it looks a little darker). How can I prevent the selected state image from replacing my custom image?

Many thanks.

+3
source share
1 answer

Found a solution: I misused the MKPinAnnotationView class instead of MKAnnotationView for my annotations. When the user pin was pressed, causing it to darken (in its backlight state), the user image was replaced with a default icon that underlines MKPinAnnotationView.

+6
source

Source: https://habr.com/ru/post/1763733/


All Articles