Http://zanderzhang.gitcafe.io/2015/09/19/iOS-Andriod Baidu Map Imitation Baidu takeout-hungry-Choose my address-poi search/
Baidu Takeout Select delivery address: hungry? Choose the shipping address:
Baidu Map API website
The first figure is to put a uiimageview in the middle of the mapview, and then we drag the map at the bottom of the run.
-(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];
}
Take the center point of the screen, which is the coordinates of Uiimageview:
geo.reversegeopoint=mapstatus.targetgeopt;
Geo is bmkreversegeocodeoption *geo; Move completion calls:
-(void) mapstatusdidchanged: (Bmkmapview *) mapview{
Bmkmapstatus *mapstatus=[mapview Getmapstatus];
geo.reversegeopoint=mapstatus.targetgeopt;
[_geosearcher Reversegeocode:geo];
NSLog (@ "mapstatusdidchanged");
}
The callback function obtains the anti-compilation result and the perimeter 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];
}
The second figure , I started using the online suggestion query , later found this poi search better use point, it has three kinds, I use the poi in the city search :
Start Search:
Bmkpoisearch =[[bmkpoisearch Alloc]init];
Bmkpoisearch.delegate = self;
Bmkcitysearchoption *option=[bmkcitysearchoption New];
Search in the city
Option.city =city;
Option.keyword = SearchText;
[Bmkpoisearch poisearchincity:option];
Callback returns:
-(void) Ongetpoiresult: (bmkpoisearch) Searcher Result: (Bmkpoiresult) Poiresult ErrorCode: (Bmksearcherrorcode) Errorcode{[suggestionsearcharr Removeallobjects];
[Suggestionsearcharr addObjectsFromArray:poiResult.poiInfoList];
[_suggestiontable Reloaddata];} `
In the poiresult there is poiinfolist, the member is Bmkpoiinfo, the same as the first figure.
Andriod is similar to this, the function is different. Friends who need demo can stay in the mailbox.
Ios-andriod Baidu Map Imitation Baidu takeout-hungry-Choose my address-poi search/