xamarin iOS地图开发

来源:互联网 发布:域名需要购买吗 编辑:程序博客网 时间:2024/05/19 23:15

<span style="font-family: Arial, Helvetica, sans-serif;">this.mapView.MapType = MonoTouch.MapKit.MKMapType.Standard;</span>
this.mapView.ShowsUserLocation = true;locationManager = new CLLocationManager ();int deviceVersion=Convert.ToInt32(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]);if (deviceVersion < 8) {} else {locationManager.RequestWhenInUseAuthorization ();}locationManager.StartUpdatingLocation ();locationManager.LocationsUpdated += LocationManagerUpdate;
<pre name="code" class="csharp">void LocationManagerUpdate (object sender, CLLocationsUpdatedEventArgs e){locationManager.StopUpdatingLocation ();MKCoordinateSpan theSpan = new MKCoordinateSpan (0.2,0.2);MKCoordinateRegion theRegion = new MKCoordinateRegion (locationManager.Location.Coordinate,theSpan);this.mapView.SetRegion (theRegion,true);}

0 0
原创粉丝点击