国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

iOS-Andriod百度地圖仿百度外賣-餓了么-選擇我的地址-POI檢索/

2019-11-14 18:17:51
字體:
供稿:網(wǎng)友

http://zanderzhang.gitcafe.io/2015/09/19/iOS-Andriod百度地圖仿百度外賣-餓了么-選擇我的地址-POI檢索/

百度外賣選擇送貨地址: 餓了么選擇送貨地址:

百度地圖api官網(wǎng)

第一個(gè)圖,就是放一個(gè)UIImageViewMapView的中間,然后我們拖動(dòng)的時(shí)候下面地圖在跑. 

-(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];

}

 

取屏幕中心點(diǎn),也就是UIImageView的坐標(biāo):

geo.reverseGeoPoint=mapStatus.targetGeoPt;

geo是BMKReverseGeoCodeOption *geo; 移動(dòng)完成會(huì)調(diào)用:

-(void)mapStatusDidChanged:(BMKMapView *)mapView{

    BMKMapStatus *mapStatus=[mapView getMapStatus];

    geo.reverseGeoPoint=mapStatus.targetGeoPt;

    [_geoSearcher reverseGeoCode:geo];

    NSLog(@"mapStatusDidChanged");

}

回調(diào)函數(shù)獲得反編譯結(jié)果和周邊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];

}

第二個(gè)圖,我開始使用在線建議查詢,后面發(fā)現(xiàn)這個(gè)POI搜索更好用點(diǎn),它有三種,我使用的是POI城市內(nèi)搜索

開始檢索: 

bMKPoiSearch =[[BMKPoiSearch alloc]init];

    bMKPoiSearch.delegate = self;

    BMKCitySearchOption *option=[BMKCitySearchOption new];

//    城市內(nèi)搜索

    option.city =city;

    option.keyWord  = searchText;

    [bMKPoiSearch poiSearchInCity:option];

 

回調(diào)返回:

-(void)onGetPoiResult:(BMKPoiSearch )searcher result:(BMKPoiResult )poiResult errorCode:(BMKSearchErrorCode)errorCode{[suggestionSearchArr removeAllObjects];

    [suggestionSearchArr addObjectsFromArray:poiResult.poiInfoList];

    [_suggestionTable reloadData];}`

 

poiResult里面有poiInfoList,成員是BMKPoiInfo,跟第一個(gè)圖一樣.

Andriod和這差不多,函數(shù)有所區(qū)別.有需要demo的朋友可以留郵箱.


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴义市| 基隆市| 柞水县| 鄂伦春自治旗| 庆阳市| 宿松县| 榆树市| 安龙县| 枣强县| 东方市| 沙湾县| 平谷区| 车险| 吴堡县| 蒙自县| 山东| 绿春县| 平定县| 高要市| 甘南县| 丹东市| 威远县| 德化县| 奉节县| 苗栗县| 榆树市| 塔河县| 云浮市| 田东县| 稻城县| 台东市| 漠河县| 铜山县| 梁河县| 鹤山市| 正定县| 奈曼旗| 鄱阳县| 镇平县| 古丈县| 海盐县|