private MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation) { MKAnnotationView annotationView = null; if (annotation is MKUserLocation) { return(null); } MKPointAnnotation anno = annotation as MKPointAnnotation; CustomPin customPin = GetCustomPin(anno); if (customPin == null) { throw new Exception("Custom pin not found"); } annotationView = mapView.DequeueReusableAnnotation(customPin.Id); if (annotationView == null) { annotationView = new CustomMKAnnotationView(annotation, customPin.Id); annotationView.Image = UIImage.FromFile("newpin.png"); annotationView.CalloutOffset = new CGPoint(0, 0); annotationView.LeftCalloutAccessoryView = new UIImageView(UIImage.FromFile("businfo2.png")); annotationView.RightCalloutAccessoryView = UIButton.FromType(UIButtonType.DetailDisclosure); ((CustomMKAnnotationView)annotationView).Id = customPin.Id; } annotationView.CanShowCallout = true; return(annotationView); }
private void OnCalloutAccessoryControlTapped(object sender, MKMapViewAccessoryTappedEventArgs e) { CustomMKAnnotationView customView = e.View as CustomMKAnnotationView; MKPointAnnotation anno = customView.Annotation as MKPointAnnotation; CustomPin customPin = GetCustomPin(anno); customPin.OnCalloutAccessoryTapped(e); }
private void OnDidSelectAnnotationView(object sender, MKAnnotationViewEventArgs e) { CustomMKAnnotationView customView = e.View as CustomMKAnnotationView; CustomPinView = new UIView(); }