public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
        {
            string resuseId = annotation is StoreAnnotation ? "pin" : "cluster";
            var    pinView  = mapView.DequeueReusableAnnotation(resuseId);

            if (pinView == null)
            {
                if (annotation is StoreAnnotation)
                {
                    pinView              = new MKAnnotationView(annotation, "pin");
                    pinView.Image        = UIImage.FromBundle("banana_pin.png");
                    pinView.CenterOffset = new CoreGraphics.CGPoint(0, -20);

                    pinView.CanShowCallout            = true;
                    pinView.LeftCalloutAccessoryView  = new UIImageView(UIImage.FromBundle("banana.png"));
                    pinView.RightCalloutAccessoryView = UIButton.FromType(UIButtonType.DetailDisclosure);
                }
                else
                {
                    pinView = new MKMarkerAnnotationView(annotation, "cluster");
                }
            }
            else
            {
                pinView.Annotation = annotation;
            }
            pinView.ClusteringIdentifier = "banana";
            return(pinView);
        }
示例#2
0
        public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
        {
            string resuseId = annotation is StoreAnnotation ? "pin" : "cluster";
            var    pinView  = mapView.DequeueReusableAnnotation(resuseId);

            if (pinView == null)
            {
                if (annotation is StoreAnnotation)
                {
                    pinView              = new MKAnnotationView(annotation, "pin");
                    pinView.Image        = UIImage.FromBundle("banana_pin.png");
                    pinView.CenterOffset = new CoreGraphics.CGPoint(0, -20);
                }
                else
                {
                    pinView = new MKMarkerAnnotationView(annotation, "cluster");
                }
            }
            else
            {
                pinView.Annotation = annotation;
            }
            pinView.ClusteringIdentifier = "banana";
            return(pinView);
        }
        public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
        {
            var pinView = new MKMarkerAnnotationView(annotation, "pin");

            var storeAnnotation = annotation as StoreAnnotation;

            if (storeAnnotation != null && storeAnnotation.TimeOpen < 9)
            {
                pinView.MarkerTintColor = UIColor.Purple;
            }
            else if (storeAnnotation != null)
            {
                pinView.MarkerTintColor = UIColor.Gray;
            }

            return(pinView);
        }
示例#4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            locMan.RequestWhenInUseAuthorization();
            map.ShowsUserLocation       = true;
            map.UserTrackingMode        = MKUserTrackingMode.Follow;
            map.Camera.CenterCoordinate = UserLocation;
            map.Camera.Pitch            = 45;

            Title = "User Location";

            AddAnnotation(UserLocation, "this is a hardcore location", "add addresses in here");

            map.GetViewForAnnotation = (mapView, annotation) => {
                var pinView = new MKMarkerAnnotationView(annotation, "pin");
                pinView.MarkerTintColor = UIColor.Purple;
                pinView.Draggable       = true;
                return(pinView);
            };
        }