public override void ViewDidLoad() { base.ViewDidLoad(); // Add default base layer AddOnlineBaseLayer(CartoBaseMapStyle.CartoBasemapStyleDefault); // Initialize a local vector data source LocalVectorDataSource source = new LocalVectorDataSource(BaseProjection); // Initialize a vector layer with the previous data source VectorLayer layer = new VectorLayer(source); // Add the previous vector layer to the map MapView.Layers.Add(layer); // Set visible zoom range for the vector layer layer.VisibleZoomRange = new MapRange(0, 18); // Create marker style UIImage image = UIImage.FromFile("icons/marker.png"); Bitmap markerBitmap = BitmapUtils.CreateBitmapFromUIImage(image); MarkerStyleBuilder builder = new MarkerStyleBuilder(); builder.Bitmap = markerBitmap; builder.Size = 30; MarkerStyle style = builder.BuildStyle(); // Add marker MapPos washington = BaseProjection.FromWgs84(new MapPos(-77.0369, 38.9072)); Marker marker = new Marker(washington, style); source.Add(marker); // Animate map to the marker MapView.SetFocusPos(washington, 1); MapView.SetZoom(12, 1); listener = new RenderListener(this, MapView); MapView.MapRenderer.CaptureRendering(listener, true); }
public override void ViewDidUnload() { base.ViewDidUnload(); listener = null; }