EmilyP EmilyP - 4 months ago 7x
iOS Question

Is it possible to select multiple MKAnnotationViews?

I am having a hard time figuring out how to let users select more than one annotation on a map at a time. My annotationViews do not show callouts, but the annotationView's image does change when selected. Is there an easy way to enable this behavior?

To clarify, I need all of the annotations that are selected to remain in a 'selected' array (not just have a visual indicator that they are selected) that can have actions performed on them as a group (for example, the user could delete all of the selected annotations at once).

Another way of stating it might be that I need to have the annotations actually be recognized as being selected, not just have that appearance.


I discovered that I had been looking at this problem for too long and was making it much harder than it was. Using MapKit, it is not possible to handle multiple selected annotations at one time.

Instead, I had to override the MKMapViewDelegate methods mapView:didSelectAnnotationView: and mapView:didDeselectAnnotationView: and create my own methods to handle saving the selected annotations to an array and removing them as well. Those methods also handled setting the appearance of selected annotations.