I want to open up the callout for an MKPinAnnotationView programmatically. Eg I drop 10 pins on the map, and want to open up the one closest to me. How would I
In swift 3 this is updated to:
func openAnnotation(annotation: MkAnnotation) {
_ = [mapView .selectAnnotation(annotation, animated: true)]
}
and can be called using any annotation (this will open the annotation callout view and attempt to center the annotation on the map)
For example using the second annotation in a hypothetical list of annotations.
openAnnotation(annotation: mapView.annotations[1])