iOS-Andriod百度地图仿百度外卖-饿了么-选择我的地址-POI检索/
http://zanderzhang.gitcafe.io/2015/09/19/iOS-Andriod百度地图仿百度外卖-饿了么-选择我的地址-POI检索/
百度外卖选择送货地址: 饿了么选择送货地址:
第一个图,就是放一个UIImageView在MapView的中间,然后我们拖动的时候下面地图在跑.
-(void)addMiddleImage{
UIImageView *imaV=[UIImageView new];
imaV.center=_mapView.center;
imaV.bounds=CGRectMake(0, 0, 24, 36);
imaV.image=[UIImage imageNamed:@"poi_icon"];
[self.view addSubview:imaV];
}
取屏幕中心点,也就是UIImageView的坐标:
geo.reverseGeoPoint=mapStatus.targetGeoPt;
geo是BMKReverseGeoCodeOption *geo; 移动完成会调用:
-(void)mapStatusDidChanged:(BMKMapView *)mapView{
BMKMapStatus *mapStatus=[mapView getMapStatus];
geo.reverseGeoPoint=mapStatus.targetGeoPt;
[_geoSearcher reverseGeoCode:geo];
NSLog(@"mapStatusDidChanged");
}
回调函数获得反编译结果和周边result.poiList:
-(void)onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error{
[geoArr removeAllObjects];
[geoArr addObjectsFromArray:result.poiList];
if (result.poiList.count) {
BMKPoiInfo *info=result.poiList[0];
_city=info.city;
}
[_bottomTable reloadData];
}
第二个图,我开始使用在线建议查询,后面发现这个POI搜索更好用点,它有三种,我使用的是POI城市内搜索:
开始检索:
bMKPoiSearch =[[BMKPoiSearch alloc]init];
bMKPoiSearch.delegate = self;
BMKCitySearchOption *option=[BMKCitySearchOption new];
// 城市内搜索
option.city =city;
option.keyword = searchText;
[bMKPoiSearch poiSearchInCity:option];
回调返回:
-(void)onGetPoiResult:(BMKPoiSearch )searcher result:(BMKPoiResult )poiResult errorCode:(BMKSearchErrorCode)errorCode{[suggestionSearchArr removeAllObjects];
[suggestionSearchArr addObjectsFromArray:poiResult.poiInfoList];
[_suggestionTable reloadData];}`
在poiResult里面有poiInfoList,成员是BMKPoiInfo,跟第一个图一样.
Andriod和这差不多,函数有所区别.有需要demo的朋友可以留邮箱.
最新文章
- robotframework----模板的使用
- PHP的学习--图解PHP引用
- zookeeper命令行(zkCli.sh&;zkServer.sh)使用及四字命令
- mongodb 几个要注意的问题
- arcgis中使用excel中x,y坐标创建点问题
- iOS-UIScrollView的delaysContentTouches与canCencelContentTouches属性
- 基于visual Studio2013解决C语言竞赛题之0803报数
- java抽象类和接口的区别(转载)
- [oracle]Oracle角色管理
- Handlebars 新手使用
- HBuilderx中编译sass文件
- php 浏览记录功能
- 关于POD和非POD类型中,list initialization和constructor initialization(未解决)
- TiDB 深度实践之旅--真实“踩坑”经历
- js 提示框的实现---组件开发之(二)
- 26、redis中默认有多少个哈希槽?
- C语言 · 企业奖金发放
- Linux服务器---本地yum
- android 管理fragment
- centos7 取消自动锁屏
热门文章
- Codeforces Round #311 (Div. 2)B. Pasha and Tea 水题
- 【JavsScript】JavaScript MVC 框架技术选型
- 安装linux系统并配置那点事
- Fork/Join框架之双端队列
- 摘录知乎上关于android开发的话题精华
- innobackupex 恢复实验
- mysqldump 安全 --skip-add-drop-table
- CENTOS YUM软件源
- 对shell中的与(&;&;)和或(||)的理解
- python编码encode和decode