public void setUpMapView() { // set the map view mapView = new MKMapView(UIScreen.MainScreen.Bounds); mapView.MapType = MKMapType.Standard; mapView.ShowsUserLocation = true; View.AddSubview(mapView); // Add annotations var userCoordinate = new CLLocationCoordinate2D(-35.3160, 149.1070); var currentUserLocation = new MKPointAnnotation() { Title = "Your Location", Coordinate = userCoordinate }; var driverUserLocation = new DriverAnnotation(("Driver's location"), new CLLocationCoordinate2D(-35.3169, 149.1075)); mapView.AddAnnotation(currentUserLocation); mapView.AddAnnotation(driverUserLocation); // set the map delegate mapDelegate = new MapViewDelegate(); mapView.Delegate = mapDelegate; // Add map center const double lat = -35.3160; const double lon = 149.1070; var mapCenter = new CLLocationCoordinate2D(lat, lon); var mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 100, 100); mapView.CenterCoordinate = mapCenter; mapView.Region = mapRegion; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (searchController != null) { searchController.Dispose(); searchController = null; } if (mapDelegate != null) { mapDelegate.Dispose(); mapDelegate = null; } }