Advertisement
Guest User

Untitled

a guest
Aug 30th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. - (void)locationManager:(CLLocationManager *)manager
  2. didUpdateToLocation:(CLLocation *)newLocation
  3. fromLocation:(CLLocation *)oldLocation {
  4.  
  5. CLLocationCoordinate2D coords = newLocation.coordinate;
  6.  
  7. lastLat = coords.latitude;
  8. lastLng = coords.longitude;
  9.  
  10. CLGeocoder *reverse = [[CLGeocoder alloc] init];
  11. CLLocation *location = [[CLLocation alloc] initWithLatitude:coords.latitude
  12. longitude:coords.longitude];
  13. lastAccuracy = newLocation.horizontalAccuracy;
  14. lblAccuracy.text = [NSString stringWithFormat:@"%f",lastAccuracy];
  15.  
  16. if(lastAccuracy <= 10)
  17. {
  18. [reverse reverseGeocodeLocation:location
  19. completionHandler:^(NSArray *placemarks, NSError *error) {
  20. if ([placemarks count] > 0) {
  21. CLPlacemark *place = [placemarks objectAtIndex:0];
  22. strCEP = place.postalCode;
  23. strLastSubLocation = place.subLocality;
  24. strLastLocation = place.locality;
  25. strEndereco = place.thoroughfare;
  26. lblEndereco.text = strEndereco;
  27. ];
  28. }
  29. }];
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement