iphonemkmapviewcllocationcallouts

iPhone Mapview update Callout View


Wonder how I can change the callout view of the pins, depending on my different current userLocation. The Pin stay still at some place. For example, a pin is settled at the church. If I am at home, I want the callout of the pin show message @"the distance from home to church is what what what" If I am at school, I want the callout of the pin show message @"the distance from school to church is what what what"

how can I update the callout view? which method should I use in the delegate?


Solution

  • This is delegate method of MKMapView which call when you tap pins calloutbutton

    - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
    

    and for annotationView (for view of pins ) use bellow delegate method..

    - (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation