How to trigger MKAnnotationView’s callout view without touching the pin? – Stack Overflow

But there is a catch to get benvolioT's solution to work, the code

for (id currentAnnotation in mapView.annotations) {
  if ([currentAnnotation isEqual:annotationToSelect]) {
    [mapView selectAnnotation:currentAnnotation animated:FALSE];
  }
}

should be called from – (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView, and nowhere else.

The sequence in which the various methods like viewWillAppear, viewDidAppear of UIViewController and the – (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView is called is different between the first time the map is loaded with one particular location and the subsequent times the map is displayed with the same location. This is a bit tricky.

via How to trigger MKAnnotationView’s callout view without touching the pin? – Stack Overflow.

,

No comments yet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.