CalloutAccessoryView view for MKPinAnnotationView

2019-09-19 17:50发布

问题:

We have rightCalloutAccessoryView and leftCalloutAccessoryView for MKPinAnnotationView

but is there if we need to add a custom button to the entire popup bubble how to add it

the main requirement is i need to perform same action when we tap on Popup bubble just like disclser Button action.

//To add a discloser button to show route map
inView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
        UIButton *detailBtn=[UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        pinView.rightCalloutAccessoryView=detailBtn;
        [detailBtn addTarget:self action:@selector(showRoute:) forControlEvents:UIControlEventTouchUpInside];

How add a custom button to this popup buble

回答1:

for putting custom button on whole mapcallout you need to add custom mapcalloutview so search for that in google there were class available for the custom callout view and this way you can create your customcallout with your custom view and button.