示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        private void OnDidSelectAnnotationView(object sender, MKAnnotationViewEventArgs e)
        {
            CustomMKAnnotationView customView = e.View as CustomMKAnnotationView;

            CustomPinView = new UIView();
        }