html+仿百度外卖地址选择,iOS-Andriod百度地图仿百度外卖-饿了么-选择我的地址-POI检索/...

百度外卖选择送货地址:

20180110164250505320.jpg20180110164250511179.jpg饿了么选择送货地址:

20180110164250517038.jpg

20180110164250527780.jpg

第一个图,就是放一个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的朋友可以留邮箱.

原文:http://www.cnblogs.com/this-is-Frank/p/4822896.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值