我根据经度和纬度值获得了当前位置,然后我还使用Annotation在Google地图上获得了多个位置.现在我想根据地址(即街道,城市和县)获取经度和纬度值.需要一些指导如何实现.
直到现在,这是我尝试过的: -
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize streetField = _streetField, cityField = _cityField, countryField = _countryField, fetchCoordinatesButton = _fetchCoordinatesButton, nameLabel = _nameLabel, coordinatesLabel = _coordinatesLabel;
@synthesize geocoder = _geocoder;
- (void)viewDidLoad
{
[super viewDidLoad];
_streetField.delegate=self;
_cityField.delegate=self;
_countryField.delegate=self;
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)fetchCoordinates:(id)sender {
NSLog(@"Fetch Coordinates");
if (!self.geocoder) {
NSLog(@"Geocdoing");
self.geocoder = [[CLGeocoder alloc] init];
}
NSString *address = [NSString stringWithFormat:@"%@ %@ %@", self.streetField.text, self.cityField.text, …Run Code Online (Sandbox Code Playgroud)