本人开发的开发者技术变现资源聚集地,大家支持下,下面是网址

https://www.baiydu.com

先说下这功能的流程,  流程:判断用户是否联网--->获取用户地理位置经纬度--->通过经纬度去查询地理位置名称

//高德地图
@property (nonatomic, strong) MAMapView *mapView;//高德地图
@property (nonatomic, strong) AMapSearchAPI *search;
@property(nonatomic,strong)NSString *longitude;
@property(nonatomic,strong)NSString *latitude;
@property (nonatomic, strong) CLLocationManager *locationManager; //本地信息存储类
@property(nonatomic,strong) AMapAddressComponent *compantAddress;
@property(nonatomic,strong) NSMutableArray *CellContentArray;
@property(nonatomic,strong)NSString *currentCityName; @property(nonatomic,strong)NSString *tempRecordIsOrNoSelect;//是否是首次加载定位 @end @implementation HomeController
//通知设置值 根据选中的地区加载相应的数据
- (void)setCurrentLocation:(NSNotification *)text{ //移除通知
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"citySelectLocationReciveceMethod" object:nil];
_currentCityName= [NSString stringWithFormat:@"%@",text.object]; if (_currentCityName.length>) {
_currentCityName=[_currentCityName substringToIndex:]; }
else
{ }
_tempRecordIsOrNoSelect=_currentCityName; } -(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
[[AFNetworkReachabilityManager sharedManager] startMonitoring];//开启网络监听
if (self.navigationController.navigationBar.hidden) {
self.navigationController.navigationBarHidden=NO;
} [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setCurrentLocation:) name:@"citySelectLocationReciveceMethod" object:nil];
//地图定位
[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
// if (_tempRecordIsOrNoSelect.length==0) {
if(status==AFNetworkReachabilityStatusNotReachable)
{
showMessage(@"请检查网络是否畅通!");
_tempRecordIsOrNoSelect=nil;
[SVProgressHUD dismiss];
return ;
}
else
{
if (_tempRecordIsOrNoSelect.length==) {
[SVProgressHUD showWithStatus:@"定位中......" maskType:SVProgressHUDMaskTypeBlack]; _longitude=[[NSString alloc]init];
_latitude=[[NSString alloc]init];
self.mapView=[[MAMapView alloc]initWithFrame:CGRectMake(, , , )];
self.mapView.userTrackingMode = ,
_mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = MAUserTrackingModeNone;
self.mapView.delegate=self;
}
else
{
CGRect tempLeftButtonFrame=self.LeftButton.frame;
_tempRecordIsOrNoSelect=_currentCityName;
[self setLeftButtonTitle:_currentCityName setFontColor:[UIColor whiteColor] setFontSize: setFrme:&tempLeftButtonFrame]; } } }]; self.title=@"首页"; //高德地图 } //高德地图代理
- (void)mapViewWillStartLocatingUser:(MAMapView *)mapView
{
if(![CLLocationManager locationServicesEnabled]){
UIAlertView * alertView = [[UIAlertView alloc]initWithTitle:@"定位失败" message:@"请在手机设置中开启定位功能\n开启步骤:设置 > 隐私 > 位置 > 定位服务" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
self.mapView = nil;
self.mapView.delegate = nil;
return;
}else{ if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorizedAlways) {
UIAlertView * alertView = [[UIAlertView alloc]initWithTitle:@"定位失败" message:@"请在手机设置中开启定位功能\n开启步骤:设置 > 隐私 > 位置 > 定位服务下《***》应用" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
self.mapView = nil;
self.mapView.delegate = nil;
return;
}
}
} - (void)mapViewDidStopLocatingUser:(MAMapView *)mapView
{ _longitude=[NSString stringWithFormat:@"%f",mapView.userLocation.location.coordinate.longitude];//@"106.546128";//
_latitude= [NSString stringWithFormat:@"%f",mapView.userLocation.location.coordinate.latitude]; //@"29.559153";
_search = [[AMapSearchAPI alloc] initWithSearchKey:@"e4bb6f15bba9fde10b1cfc13b298370e" Delegate:self];
AMapReGeocodeSearchRequest *regeoRequest = [[AMapReGeocodeSearchRequest alloc] init];
regeoRequest.searchType = AMapSearchType_ReGeocode; regeoRequest.location =[AMapGeoPoint locationWithLatitude:[_latitude floatValue] longitude:[_longitude floatValue]];
regeoRequest.radius = ;
regeoRequest.requireExtension = YES; //发起逆地理编码
[_search AMapReGoecodeSearch: regeoRequest]; }
//逆编码查询代理
- (void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response
{
if(response.regeocode != nil)
{ _compantAddress=response.regeocode.addressComponent; _currentCityName=_compantAddress.province;
if (_currentCityName.length>) {
_currentCityName=[_currentCityName substringToIndex:];
}
_tempRecordIsOrNoSelect=_currentCityName;//定位后也要给这个临时判断是否选择的变量赋值 [self setLeftButtonTitle:_currentCityName setFontColor:[UIColor whiteColor] setFontSize: setFrme:&computeFrame]; UIImageView *pointView=[[UIImageView alloc]initWithFrame:CGRectMake(computeFrame.size.width-,, , )];
[pointView setImage:[UIImage imageNamed:@"fanhuijiantou.png"]]; [pointView setBackgroundColor:[UIColor clearColor]]; [self.LeftButton addSubview:pointView]; [self.LeftButton addTarget:self action:@selector(changeLocationClick:) forControlEvents:UIControlEventTouchUpInside]; self.LeftButton.hidden=NO; }
else{
showMessage(@"请检查网是否畅通!");
}
[SVProgressHUD dismiss];
}
- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation
{ mapView.showsUserLocation = NO; }

本人做的一款androidApp,积分墙下载可兑支付宝红包,无广告看最新国内外大片,各种当前热门H5页游,淘宝天猫高额购物券!!:扫描下载,多谢支持!若有需要做此类产品的可以联系我:2819936788,各类数据API接口!(手机/流量/QB/游戏/淘宝客高额优惠券/超便宜的代理IP API/产品推广工具API)

 

IOS高德地图逆地理编码定位+网络判断的更多相关文章

  1. android studio高德地图的显示于定位(附带逆地理编码围栏)

    首先注册高德成为开发者(打开高德地图,点击底部的开发者平台),创建应用,按照要求填写相应信息 网站:http://lbs.amap.com/api/android-sdk/guide/create-p ...

  2. 【高德地图API】地理编码与逆地理编码

    一.地理编码 该功能实现地理编码服务,即地址匹配,从已知的地址描述到对应的经纬度坐标的转换,即根据地址信息,查询该地址所对应的点坐标等,地址(address) 为必选项,城市(city)为可选项. & ...

  3. 微信小程序地图之逆地理编码

    首先说一下,我微信自带map的api中并没有相关接口可调用.文中的方法建立于高德地图.(顺便吐槽,微信开发文档相比支付宝家的显得好烂!) 最近做项目用到地图定位相关的需求,为了搞定需求看了下相关的文档 ...

  4. iOS高德地图SDK定位和搜索附近信息的具体使用

    1.显示地图.定位.显示当前位置. 导入你需要的功能的头文件,申明全局变量,代理方法等等.   初始化地图,在控制器即将显示额时候打开定位和跟踪用户,这里对参数不懂的话康忙进去都有注释.   对了.i ...

  5. iOS:高德地图的使用

    本人花了点时间集成了高德地图的几乎所有的功能,包含:地图的显示.地图的绘制.地图的定位.地图的POI数据检索.地图的线路规划.地图导航等下载地址如下:https://github.com/xiayua ...

  6. 高德地图api之location定位

    关于定位,分为GPS定位和网络定位.本文将详细描述的浏览器定位,属于网络定位.这是一种通过使用高德JS-API来实现位置定位.城市定位的方法,包含了IP定位,检索等多种网络定位方式.如果您的手机支持G ...

  7. iOS 高德地图轨迹回放的 思路, 及方法

    // 开始,公司要求制作一段跑步轨迹 在地图上的 动画回放, 传入一段经纬度, 开始一想,这不是很简单吗, 高德地图有可以把经纬度转换成坐标点的方法 /** * @brief 将经纬度转换为指定vie ...

  8. iOS高德地图使用-搜索,路径规划

    项目中想加入地图功能,使用高德地图第三方,想要实现确定一个位置,搜索路线并且显示的方法.耗了一番功夫,总算实现了. 效果 WeChat_1462507820.jpeg 一.配置工作 1.申请key 访 ...

  9. Android编程 高德地图 中如何重写 定位按键 的触发事件 (com.amap.api.maps2d.LocationSource)点击定位后不仅定位在地图中心点上而且可以设置地图的缩放大小和提示

    在利用高德地图来编写自己的APP的时候,发现了一种对定位按键的重写方法,那就是利用   com.amap.api.maps2d.LocationSource  接口来重写. 什么是定位按键呢,下图中右 ...

随机推荐

  1. NodeJS系列~第二个小例子,解决中文乱码的问题

    返回目录 为了使页面支持的字符更多,所以编码使用UTF-8,注意,你的原js文件的编码也要是utf-8的,可以通过记事本进行编码的修改

  2. Node.js与Sails~Model数据模型

    回到目录 对于Sails来说,它的Model与数据库对应,不过它并没有采用目前比较流行的poco贫血模型,而是采用了类似DDD的充血模型,即它的数据实体里即有数据库字段(属性)而且还有方法,而模型里的 ...

  3. Atitit blend mode COLOR_DODGE 混合模式  “颜色减淡”模式

    Atitit blend mode COLOR_DODGE 混合模式  "颜色减淡"模式 1.1. 混合模式是图像处理技术中的一个技术名词1 1.2. 目录1 1.3. 颜色减淡C ...

  4. Atitit 全屏模式的cs桌面客户端软件gui h5解决方案 Kiosk模式

    Atitit 全屏模式的cs桌面客户端软件gui h5解决方案 Kiosk模式 1.1. Kiosk Software广泛用于公共电脑或者嵌入系统,最常用的就是ATM机.自动服务机之类的系统了.,1 ...

  5. Atitti  css   transition Animation differ区别

    Atitti  css   transition Animation differ区别 1.1. transition的优点在于简单易用,但是它有几个很大的局限.  1 1.2. js 动态改变 st ...

  6. Atitit.java图片图像处理attilax总结

    Atitit.java图片图像处理attilax总结 BufferedImage extends java.awt.Image 获取图像像素点 image.getRGB(i, lineIndex); ...

  7. pycharm快捷键 - 官方全

    pycharm快捷键 - 官方全 Ctrl + F12 显示文件内的成员,继承的成员

  8. java之内部类详解

    序言 有位小同学要我写一篇这个的总结,我说那好吧,那就动手写总结一下这个内部类的知识,感觉这个在面试中也会经常遇到,内部类.反射.集合.IO流.异常.多线程.泛型这些重要的基础知识大家都比较容易记不住 ...

  9. Create New Commands in Tcl

    Create New Commands in Tcl eryar@163.com 摘要Abstract:Tcl/Tk脚本可以很容易实现用户自定义的命令,方便的创建图形化的用户界面GUI,所以Tcl和T ...

  10. java集合框架之List

    一.List: 1.  特有的常见方法:(有个共性特点就是都可以操作角标) (1).添加 void add(int Index , E element):在list的指定位置插入元素 void add ...