//搜索poi数据
-(void)searchPOI:(NSString*)keyword
{
// mKeyWord = keyword;
int curPage = 0;
BMKCitySearchOption *citySearchOption = [[BMKCitySearchOption alloc]init];
citySearchOption.pageIndex = curPage;
citySearchOption.pageCapacity = 20;
// MYLog(@"%@",_city);
//定位城市
if(self.currentCity != nil){
citySearchOption.city= self.currentCity;
}else{
citySearchOption.city= @"北京市";
}
citySearchOption.keyword = keyword;
if(_poisearch==NULL){
_poisearch = [[BMKPoiSearch alloc]init];
_poisearch.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放
}
BOOL flag = [_poisearch poiSearchInCity:citySearchOption];
if(flag)
{
NSLog(@"城市内检索发送成功");
}
else
{
// _nextPageButton.enabled = false;
NSLog(@"城市内检索发送失败");
}
}
//2.搜索成功后在回调中根据uid发起poi短串搜索
- (void)onGetPoiResult:(BMKPoiSearch *)searcher result:(BMKPoiResult*)result errorCode:(BMKSearchErrorCode)error
{
if (error == 0) {
if(result.poiInfoList.count>0)
{
//获取第一个poi点的数据
// BMKPoiInfo* poi = [result.poiInfoList objectAtIndex:0];
[_dataDetialArray removeAllObjects];
[_dataDetialArray addObjectsFromArray:result.poiInfoList];
// for (BMKPoiInfo* poi in result.poiInfoList) {
// MYLog(@"名字%@",poi.name);
// MYLog(@"位置%@",poi.address);
// }
// MYLog(@"%@",poi.name);
[self.tableView reloadData];
}
}
}