【问题标题】:Coordinates/Region from Country Name国家名称的坐标/地区
【发布时间】:2012-04-13 06:31:59
【问题描述】:

如何根据正确书写的国家/地区名称提取CLRegionCLLocationCoordinate2D 或纬度/经度点? CLGeocoder 会这样工作吗:

 CLGeocoder *geoCode = [[CLGeocoder alloc] init];
[geoCode geocodeAddressString:@"Singapore" completionHandler:^(NSArray *placemarks,       NSError *error) {
if (!error) {
      CLPlacemark *place = [placemarks objectAtIndex:0];
NSLog(@"%i,%i", place.//what would i put here);

}


   }];

CLPlacemark 持有什么变量来告知地址?

【问题讨论】:

    标签: objective-c ios xcode mapkit core-location


    【解决方案1】:

    没关系:

      CLGeocoder *geoCode = [[CLGeocoder alloc] init];
    [geoCode geocodeAddressString:@"Singapore" completionHandler:^(NSArray *placemarks, NSError *error) {
        if (!error) {
            CLPlacemark *place = [placemarks objectAtIndex:0];
            CLLocation *location = place.location;
            CLLocationCoordinate2D coord = location.coordinate;
            NSLog(@"%g is latitude and %g is longtitude", coord.latitude, coord.longitude);
    
        }
    
    
    }];  
    

    【讨论】:

      猜你喜欢
      • 2011-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-20
      • 1970-01-01
      • 1970-01-01
      • 2011-01-05
      • 1970-01-01
      相关资源
      最近更新 更多