private void locationUpdated(object sender, CLLocationUpdatedEventArgs e) { Map.CenterCoordinate = e.NewLocation.Coordinate; Map.Region = MKCoordinateRegion.FromDistance (e.NewLocation.Coordinate, 5000, 5000); var annotation = new MapAnnotation("Current Location", e.NewLocation.Coordinate); Map.AddAnnotation(annotation); }
private void locationUpdated(object sender, CLLocationUpdatedEventArgs e) { Map.CenterCoordinate = e.NewLocation.Coordinate; Map.Region = MKCoordinateRegion.FromDistance(e.NewLocation.Coordinate, 5000, 5000); var annotation = new MapAnnotation("Current Location", e.NewLocation.Coordinate); Map.AddAnnotation(annotation); }
public override void ViewDidLoad() { base.ViewDidLoad (); var newYorkCity = new CLLocationCoordinate2D(40.716667, -74); Map.CenterCoordinate = newYorkCity; Map.Region = MKCoordinateRegion.FromDistance(newYorkCity, 5000, 5000); var annotation = new MapAnnotation("New York City", newYorkCity); Map.AddAnnotation(annotation); _locationManager = new CLLocationManager(); _locationManager.UpdatedLocation += locationUpdated; _locationManager.DistanceFilter = 20; _locationManager.DesiredAccuracy = CLLocation.AccuracyHundredMeters; _locationManager.StartUpdatingLocation(); }
public override void ViewDidLoad() { base.ViewDidLoad(); var newYorkCity = new CLLocationCoordinate2D(40.716667, -74); Map.CenterCoordinate = newYorkCity; Map.Region = MKCoordinateRegion.FromDistance(newYorkCity, 5000, 5000); var annotation = new MapAnnotation("New York City", newYorkCity); Map.AddAnnotation(annotation); _locationManager = new CLLocationManager(); _locationManager.UpdatedLocation += locationUpdated; _locationManager.DistanceFilter = 20; _locationManager.DesiredAccuracy = CLLocation.AccuracyHundredMeters; _locationManager.StartUpdatingLocation(); }