private MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation) { MKAnnotationView annotationView = null; var anno = annotation as MKPointAnnotation; var customPin = GetCustomPin(anno); if (customPin == null) { return(null); } annotationView = mapView.DequeueReusableAnnotation("pin"); if (annotationView == null) { annotationView = new MKAnnotationView(annotation, "pin"); ColorPointAnnotation colorPointAnnotation = annotation as ColorPointAnnotation; if (colorPointAnnotation != null) { annotationView.Image = GetPinImage(colorPointAnnotation.pinColor); } } annotationView.CanShowCallout = true; return(annotationView); }
private void FormsMap_PinsUpdated(object sender, EventArgs e) { var nativeMap = Control as MKMapView; if (nativeMap != null) { customPins = ((CustomMap)Element).CustomPins; foreach (var pin in customPins) { var annotation = new ColorPointAnnotation(pin); nativeMap.AddAnnotation(annotation); } } }