Sunday, August 19, 2018

Custom Callout Dialogue for map annotation

I don't know much about the MK_MapView, but I inherited a project that needs to have a custom dialogue popup when the user taps an annotation on the map.

Currently the dialogue is a custom MKAnnotation that uses the title, subtitle and detail disclosure. I need a dialogue that essentially looks exactly the same but with one additional line added to it under the subtitle.

I have yet to find a good guide or steps to crate a custom callout dialogue.

I found this Custom MKAnnotation callout bubble with button but when i do the steps provided in the didSelet method, i get a display of both the custom popup and the original, displayed on top of each other.

How can i get what i need?

Thanks

Solved

Where you create your MKAnnotationView in (If you don´t have implement this methods, is part of MKMapViewDelegate) copy like that, near that (- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view):

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation
 {
 static NSString *reuseIdentifier = @"reuseIdentifier";
 MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier];
annotationView.canShowCallout = NO;



 return annotationView;
 }

No comments:

Post a Comment