In this recipe, we will learn how to provide information about an address, city, or country based on location coordinates.
Perform the following steps:
Add an
MKMapView
on the top half of the view ofMainController
, a label, and a button on the bottom half.Add the
MonoTouch.MapKit
andMonoTouch.CoreLocation
namespaces in theGeocodingAppViewController.cs
file.Enter the following
ViewDidLoad
method in the class:private CLGeocoder geocoder; public override void ViewDidLoad () { base.ViewDidLoad (); this.mapView.ShowsUserLocation = true; this.btnGeocode.TouchUpInside += async (sender, e) => { this.lblOutput.Text = "Reverse geocoding location..."; this.btnGeocode.Enabled = false; CLLocation currentLocation = this.mapView.UserLocation.Location; this.mapView.SetRegion(MKCoordinateRegion.FromDistance(currentLocation.Coordinate, 1000, 1000), true); ...