Description: Suppose you need to go to a resturent which is at 10th floor in a building, how do you provide directions to user to that place?
iOS[assembly: ExportRenderer(typeof(Map3d), typeof(MapView3dRenderer))]namespace MyApp.iOS.Renderers{ public class MapView3dRenderer : MapRenderer { MKMapView _nativeMap;
protected override void OnElementChanged(ElementChangedEventArgs<View> e) { base.OnElementChanged(e); if (e.NewElement != null && Control != null) { _nativeMap = Control as MKMapView; } } protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (_nativeMap == null) return; if (e.PropertyName == "VisibleRegion") UpdateCameraView(); } void UpdateCameraView() { var target = new CLLocationCoordinate2D(50.890119f, 5.857798f); //Enable 3D buildings _nativeMap.ShowsBuildings = true; _nativeMap.PitchEnabled = true; // Attach the camera var camera = MKMapCamera.CameraLookingAtCenterCoordinate(target, 650, 60, 0); _nativeMap.Camera = camera; }}
protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
base.OnElementChanged(e);
if (e.NewElement != null && Control != null)
_nativeMap = Control as MKMapView;
}
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
base.OnElementPropertyChanged(sender, e);
if (_nativeMap == null)
return;
if (e.PropertyName == "VisibleRegion")
UpdateCameraView();
void UpdateCameraView()
var target = new CLLocationCoordinate2D(50.890119f, 5.857798f);
//Enable 3D buildings
_nativeMap.ShowsBuildings = true;
_nativeMap.PitchEnabled = true;
// Attach the camera
var camera = MKMapCamera.CameraLookingAtCenterCoordinate(target, 650, 60, 0);
_nativeMap.Camera = camera;
Android// Create the cameraCameraPosition cameraPosition = new CameraPosition.Builder() .Target(location) .Tilt(45) .Zoom(10) .Bearing(0) .Build();// Convert to an update objectCameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
// Attach the cameramap.MoveCamera(cameraUpdate); // map is of type GoogleMap