Ich möchte ein Info-Fenster für eine Google-Kartenmarkierung erstellen, um ein Button-Klick-Ereignis im Infofenster meiner iOS-Anwendung bereitzustellen. Gibt es eine Möglichkeit, dies zu tun?Button-Klick-Ereignis in einem Kartenmarker-Infofenster
1
A
Antwort
0
Hope this helfen Ihnen
extension ViewController: MKMapViewDelegate {
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
return nil
}
let identifier = "MyCustomAnnotation"
var annotationView = mapView.dequeueReusableAnnotationViewWithIdentifier(identifier)
if annotationView == nil {
annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
annotationView?.canShowCallout = true
} else {
annotationView!.annotation = annotation
}
let myButton = UIButton()
annotationView?.leftCalloutAccessoryView = myButton
return annotationView
}
}
+1
Vielen Dank. aber ich benutze kein Kartenkit. – user3480213
+0
Oh Entschuldigung, ich habe das nicht gesehen: \ –
fand ich dieses Video von 2013, hoffen, dass diese Ihnen helfen können: https://www.youtube.com/watch?v=ILiBXYscsyY –
und ein anderes Thema auf Stackoverflow: http://stackoverflow.com/questions/16746765/custom-info-window-for-google-maps –