Guest User

Untitled

a guest
Jun 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. public override void ViewDidLoad ()
  2. {
  3.     base.ViewDidLoad ();
  4.  
  5.     double longitud = -8.756193515625D;
  6.     double latitud = 41.6482883125936; 
  7.     CLLocationCoordinate2D coordinates = new CLLocationCoordinate2D(latitud,longitud); 
  8.        
  9.     // Retrieve the placemark on these new coords
  10.     MKReverseGeocoder reverseGeocoder = new MKReverseGeocoder(coordinates);
  11.     ReverseGeocoderDelegate geocoderDelegate = new ReverseGeocoderDelegate();
  12.     reverseGeocoder.Delegate = geocoderDelegate;
  13.     reverseGeocoder.Start();
  14. }
  15.  
  16.  
  17. private class ReverseGeocoderDelegate : MKReverseGeocoderDelegate
  18. {
  19.     public ReverseGeocoderDelegate(IntPtr handle) : base(handle) { }
  20.            
  21.     public ReverseGeocoderDelegate() : base()
  22.     {
  23.     }
  24.            
  25.            
  26.     public override void FoundWithPlacemark (MKReverseGeocoder geocoder, MKPlacemark placemark)
  27.     {
  28.         string locationString = placemark.Title;
  29.         if(String.IsNullOrEmpty(locationString))
  30.         {
  31.             locationString = placemark.Locality;
  32.         }
  33.     }
  34.            
  35.     public override void FailedWithError (MKReverseGeocoder geocoder, NSError error)
  36.     {
  37.     }
  38. }
Add Comment
Please, Sign In to add comment