I need the callout bubble to show without the user tapping on the pin. Basically, once I add the pin to the map, the callout bubble should be displayed.
Is this possible with SDK 3.0?
Quote:
Originally Posted by zaplitny
Not sure I understood correctly but may be setCanShowCallout of MKAnnotationView is the thing you need
I need the callout bubble to show without the user tapping on the pin. Basically, once I add the pin to the map, the callout bubble should be displayed.
Although [mapView selectAnnotation:currentAnnotation animated:FALSE] is the solution, but there is a catch to get it work consistently:
the code
for (id currentAnnotation in mapView.annotations) {
if ([currentAnnotation isEqual:annotationToSelect]) { [mapView selectAnnotation:currentAnnotation animated:FALSE]; } }
should be called from - (void)mapViewDidFinishLoadingMapMKMapView *)mapView, and nowhere else.
The underlying reason is a bit tricky:
The sequence in which the various methods like viewWillAppear, viewDidAppear of UIViewController and the - (void)mapViewDidFinishLoadingMapMKMapView *)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.
Although [mapView selectAnnotation:currentAnnotation animated:FALSE] is the solution, but there is a catch to get it work consistently:
the code
for (id currentAnnotation in mapView.annotations) {
if ([currentAnnotation isEqual:annotationToSelect]) { [mapView selectAnnotation:currentAnnotation animated:FALSE]; } }
should be called from - (void)mapViewDidFinishLoadingMapMKMapView *)mapView, and nowhere else.
The underlying reason is a bit tricky:
The sequence in which the various methods like viewWillAppear, viewDidAppear of UIViewController and the - (void)mapViewDidFinishLoadingMapMKMapView *)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.
I am using XCODE 3.1.4 with the 3.1.2 SDK and I found that I had to put this in both the mapViewDidFinishLoadingMap and in viewWillAppear in my map view controller class in order for it to work reliably. As you indicated, the order that methods are called for the first time is different for subsequent calls for the same location according to my code traces. I really appreciate the information provided here as I was unable to find it anywhere else.