Adding an accessory view button to the MKMapView call out annotation?

后端 未结 3 2248
既然无缘
既然无缘 2021-02-14 15:37

I\'ve recently come across this website and I\'ve been trying to add to my call out view a button (from a image).

The code on the websites example works just fine, but w

3条回答
  •  花落未央
    2021-02-14 16:17

    Instead of setting the target like you did here:

    [advertButton addTarget:self action:@selector(showLinks:) forControlEvents:UIControlEventTouchUpInside];
    

    You can use the default delegate:

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

提交回复
热议问题