网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

iOS如何将地址解析成经纬度

这篇文章将为大家详细讲解有关iOS如何将地址解析成经纬度,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

创新互联建站专注于企业网络营销推广、网站重做改版、佛山网站定制设计、自适应品牌网站建设、H5网站设计购物商城网站建设、集团公司官网建设、成都外贸网站建设公司、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为佛山等各大城市提供网站开发制作服务。

具体内容如下

一、工程图

iOS如何将地址解析成经纬度

二、代码

ViewController.h

#import 
#import 
#import 

@interface ViewController : UIViewController


@end

ViewController.m

#import "ViewController.h"
#import 
#import 


//正编译。将地址解析为经纬度
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  
  
  CLGeocoder *geocoder = [[CLGeocoder alloc] init];
  [geocoder geocodeAddressString:@"上海徐汇漕溪路" completionHandler:^(NSArray *placemarks, NSError *error){
    NSLog(@"查询记录数:%ld",[placemarks count]);
    if ([placemarks count] > 0) {
      CLPlacemark *placemark = [placemarks objectAtIndex:0];
      CLLocationCoordinate2D coordinate = placemark.location.coordinate;
      
      NSString *strCoordinate = [NSString stringWithFormat:@"经度:%3.5f 纬度:%3.5f:",coordinate.latitude,coordinate.longitude ];
      NSLog(@"%@",strCoordinate);
    }
  }];

}

- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
}

@end

关于“iOS如何将地址解析成经纬度”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


网站栏目:iOS如何将地址解析成经纬度
网站网址:http://bjjierui.cn/article/iheego.html

其他资讯