public void OpenPin(object sender, MapEventArgs e) { Position p = e.position; string address = e.address; CLLocationCoordinate2D center = new CLLocationCoordinate2D(p.Latitude, p.Longitude); MapKit.MKPlacemarkAddress m_address = new MapKit.MKPlacemarkAddress(new Foundation.NSDictionary()); MapKit.MKPlacemark placeMark = new MapKit.MKPlacemark(center, m_address); var map = new MapKit.MKMapItem(placeMark); MapKit.MKCoordinateSpan corSpan = new MapKit.MKCoordinateSpan(); corSpan.LatitudeDelta = p.Latitude; corSpan.LongitudeDelta = p.Longitude; MapKit.MKLaunchOptions options = new MapKit.MKLaunchOptions(); options.DirectionsMode = MapKit.MKDirectionsMode.Driving; options.MapCenter = center; map.Name = address; options.MapSpan = corSpan; options.MapType = MapKit.MKMapType.Standard; MapKit.MKMapItem current = MapKit.MKMapItem.MapItemForCurrentLocation(); MapKit.MKMapItem[] arrayKit = new MapKit.MKMapItem[] { current, map }; MapKit.MKMapItem.OpenMaps(arrayKit, options); }
void SetMapToCoordinate(CoreLocation.CLLocationCoordinate2D coordinate) { var currentSpan = new MapKit.MKCoordinateSpan(0.05, 0.05); var region = new MapKit.MKCoordinateRegion(coordinate, currentSpan); var newCenterPoint = MapKit.MKMapPoint.FromCoordinate(coordinate); CoffeeMap.SetVisible(new MapKit.MKMapRect(newCenterPoint.X, newCenterPoint.Y, currentSpan.LatitudeDelta, currentSpan.LongitudeDelta)); CoffeeMap.SetRegion(region); }
void SetMapToCoordinate(CoreLocation.CLLocationCoordinate2D coordinate) { var currentSpan = new MapKit.MKCoordinateSpan (0.05, 0.05); var region = new MapKit.MKCoordinateRegion (coordinate, currentSpan); var newCenterPoint = MapKit.MKMapPoint.FromCoordinate (coordinate); CoffeeMap.SetVisible (new MapKit.MKMapRect (newCenterPoint.X, newCenterPoint.Y, currentSpan.LatitudeDelta, currentSpan.LongitudeDelta)); CoffeeMap.SetRegion (region); }