1. Search first
Cllocationdistance radiusmeters = 1000; // set the search range bmksearch * search = [[bmksearch alloc] init]; // create a search object search. delegate = self; // The proxy is set to itself. After searching, the function [search into earchnearby: "KFC" center: mapview. centercoordinate radius: radiusmeters pageindex: 0]; // search for KFC in the center of the screen // [Search release]; // Note: release is not supported; otherwise, it cannot be searched. Define search as a member variable.
2. Process search results
-(Void) ongetpoiresult :( nsarray *) poiresultlist searchtype :( INT) type errorcode :( INT) error {If (error = bmkerrok) {bmkpoiresult * result = [poiresultlist objectatindex: 0]; for (INT I = 0; I <result. poiinfolist. count; ++ I) {bmkpoiinfo * poi = [result. poiinfolist objectatindex: I]; bmkpointannotation * Item = [[bmkpointannotation alloc] init]; item. coordinate = poi.pt; item. title = poi. name; [mapview addannotation: item]; [item release] ;}}
The above callback will automatically display the searched poi on the map through annotation.
IOS development based on Baidu map (1) -- current user location
IOS development based on Baidu map (2) -- getting poi
IOS development based on Baidu map (3) -- address search
IOS development based on Baidu map (4) -- path search
IOS development based on Baidu map (5)-Summary of core issues
IOS development based on Baidu map (6) -- Google coordinates to hundreds of coordinates
IOS development based on Baidu map (7) -- convert Baidu coordinates to Google coordinates