public override void HideIncidentInformationPanel() { // close all selected annotations var annotations = _nativeMap?.SelectedAnnotations; if (annotations != null) { foreach (var annotation in annotations) { _nativeMap.DeselectAnnotation(annotation, false); } } }
public override void DeselectCluster(CKCluster cluster, bool animated) { if (!_internalMap.SelectedAnnotations.Contains(cluster)) { return; } _internalMap.DeselectAnnotation(cluster, animated); }
/// <summary> /// Handles when our region has changed. /// </summary> /// <param name="mapView"></param> /// <param name="animated"></param> public override void RegionChanged(MKMapView mapView, bool animated) { // TODO: Casts really needed or is there a better way? if (((ClusterMapView)mapView).IsAnimatingClusters) { ((ClusterMapView)mapView).ShouldComputeClusters = true; } else { ((ClusterMapView)mapView).IsAnimatingClusters = true; ((ClusterMapView)mapView).ClusterInMapRect(mapView.VisibleMapRect); } if (mapView.SelectedAnnotations != null) { foreach (var annotation in mapView.SelectedAnnotations) { mapView.DeselectAnnotation(annotation, true); } } }
public static void DeselectCluster(this MKMapView map, CKCluster cluster, bool animated) { map.DeselectAnnotation(cluster, animated); }
/// <summary> /// This is very much like the GetCell method on the table delegate /// </summary> public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, IMKAnnotation annotation) { if(ThisIsTheCurrentLocation(mapView, annotation)) { return null; } // try and dequeue the annotation view MKAnnotationView annotationView = mapView.DequeueReusableAnnotation(annotationIdentifier); // if we couldn't dequeue one, create a new one if (annotationView == null) annotationView = new MKAnnotationView(annotation, annotationIdentifier); else // if we did dequeue one for reuse, assign the annotation to it annotationView.Annotation = annotation; // configure our annotation view properties annotationView.CanShowCallout = true; nfloat r; nfloat g; nfloat b; nfloat a; RandomColorHelper.GetRandomColor().GetRGBA(out r, out g, out b, out a); if (annotation.GetType () == typeof(HouseMapAnnotation)) { var rank = (annotation as HouseMapAnnotation).Rank; var fontSize = rank.Length >= 3 ? 9 : 15; annotationView.Image = LightMapPointStyleKit.ImageOfLightMapPoint ((float)r, (float)g, (float)b, (float)a, rank, fontSize); annotationView.Selected = true; // you can add an accessory view, in this case, we'll add a button on the right, and an image on the left detailButton = UIButton.FromType(UIButtonType.DetailDisclosure); detailButton.TintColor = UIColor.Black; detailButton.TouchUpInside += (s, e) => { Console.WriteLine ("Clicked"); var detailViewController = UIStoryboard.FromName ("MainStoryboard", null).InstantiateViewController("HouseDetailsViewController") as HouseDetailsViewController; detailViewController.Annotation = annotation as HouseMapAnnotation; mapView.DeselectAnnotation(annotation,true); this.parent.NavigationController.PushViewController(detailViewController,true); }; annotationView.RightCalloutAccessoryView = detailButton; FetchImageAsync(annotationView,(annotation as HouseMapAnnotation).House); } return annotationView; }