public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation) { var pet = ((CustomAnnotation)annotation).Model; var petAnnotationType = GetPetAnnotationType(pet); var pin = (MapAnnotationView)mapView.DequeueReusableAnnotation(petAnnotationType); string pinImage = petAnnotationType + ".png"; if (pin == null) { pin = new MapAnnotationView(annotation, petAnnotationType); pin.Image = UIImage.FromBundle(pinImage); pin.CenterOffset = new CGPoint(0, -15); } else { pin.Annotation = annotation; } pin.Draggable = _pinIsDraggable; pin.CanShowCallout = _canShowCallout; if (_canShowCallout) { Task.Run(async() => pin.LeftCalloutAccessoryView = await GetImage(pet)); pin.RightCalloutAccessoryView = GetDetailButton(pet); } return(pin); }
public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, NSObject annotation) { var pet = ((CustomAnnotation)annotation).Model; var petAnnotationType = GetPetAnnotationType (pet); var pin = (MapAnnotationView)mapView.DequeueReusableAnnotation(petAnnotationType); string pinImage = petAnnotationType + ".png"; if (pin == null) { pin = new MapAnnotationView(annotation, petAnnotationType); pin.Image = UIImage.FromBundle(pinImage); pin.CenterOffset = new PointF (0, -15); } else { pin.Annotation = annotation; } pin.Draggable = _pinIsDraggable; pin.CanShowCallout = _canShowCallout; if (_canShowCallout) { Task.Run( async () => pin.LeftCalloutAccessoryView = await GetImage(pet)); pin.RightCalloutAccessoryView = GetDetailButton (pet); } return pin; }