//苹果系统自带地图是高德苹果在中国的地图服务商是高德
//需要用的框架 #import
//定位比较耗电
//通过网络进行的定位
//定位用户的经纬度
//根据经纬度计算两个位置的距离
//监控用户进入或离开某一区域
//地理编码地名 ->经纬度
//反地理编码经纬度 ->地名
//////////////////////////////////////////////
//#import
//地图的类型
//跟踪用户的位置
//监听地图的行为(放大或缩小滚动等)需要设置代理 MKMapViewDelegate
//显示某一块指定区域特定区域和位置
//添加大头针
//自定义大头针
//自定义点大头针弹出视图
//自空间不在父控件范围内时接收点击事件
//指定起点和终点进行画线
//导航: 1跳到苹果官方地图 2用百度地图自己是没法写的因为需要大量的路况等相关信息
//集成百度地图 数据众包(用户反馈给应用)
//百度地图的集成直接下载百度地图Demo参考文档集成就可以了
//合并两个静态库,一个真机的一个模拟器的
//POI搜索 (周边搜索)
////////////////////系统自带地图/////////////////////
导入 两个库
引用地图前 尽量用真机测试 模拟器的话 等程序运行起来之后点击 xcode下方的 位置图片按钮标识 便可
需在info.plist中追加NSLocationWhenInUseUsageDescription或NSLocationAlwaysUsageDescription字段.其中:
NSLocationWhenInUseUsageDescription表示应用在前台的时候可以搜到更新的位置信息。
NSLocationAlwaysUsageDescription表示应用在前台和后台(suspend或terminated)都可以获取到更新的位置数据。
*/
#import "ViewController.h"
#import
#import
@interface
ViewController ()
{
MKMapView *_mapView;
CLLocationManager *locationManager;
CLLocation *location;
}
@end
@implementation
ViewController
- (
void
)viewDidLoad {
[
super
viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_mapView =[[MKMapView alloc]initWithFrame:
self
.view.bounds];
_mapView.zoomEnabled =
YES
;
_mapView.showsUserLocation =
YES
;
_mapView.scrollEnabled =
YES
;
_mapView.delegate =
self
;
[
self
.view addSubview:_mapView];
if
([[
UIDevice
currentDevice].systemVersion floatValue] > 8.0f)
{
[
self
getUserLocation];
}
// 长按手势 长按添加大头针
UILongPressGestureRecognizer
*lpgr = [[
UILongPressGestureRecognizer
alloc]initWithTarget:
self
action:
@selector
(lpgrClick:)];
[_mapView addGestureRecognizer:lpgr];
}
//获取当前位置
- (
void
)getUserLocation
{
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate =
self
;
//kCLLocationAccuracyBest:设备使用电池供电时候最高的精度
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
locationManager.distanceFilter = 50.0f;
if
(([[[
UIDevice
currentDevice] systemVersion] doubleValue] >= 8.0))
{
[locationManager requestAlwaysAuthorization];
}
//更新位置
[locationManager startUpdatingLocation];
}
#pragma mark-CLLocationManagerDelegate 位置更新后的回调
-(
void
)locationManager:(CLLocationManager *)manager didUpdateLocations:(
NSArray
*)locations
{
//停止位置更新
[locationManager stopUpdatingLocation];
CLLocation *loc = [locations firstObject];
CLLocationCoordinate2D theCoordinate;
//位置更新后的经纬度
theCoordinate.latitude = loc.coordinate.latitude;
theCoordinate.longitude = loc.coordinate.longitude;
//设定显示范围
MKCoordinateSpan theSpan;
theSpan.latitudeDelta=0.01;
theSpan.longitudeDelta=0.01;
//设置地图显示的中心及范围
MKCoordinateRegion theRegion;
theRegion.center=theCoordinate;
theRegion.span=theSpan;
[_mapView setRegion:theRegion];
location = [locations lastObject];
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:^(
NSArray
*array,
NSError
*error)
{
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:^(
NSArray
*array,
NSError
*error) {
if
(array.count > 0)
{
CLPlacemark *placemark = [array objectAtIndex:0];
// 将获得的所有信息显示到label上
NSLog
(@
"%@"
,placemark.administrativeArea);
// 获取城市
NSString
*city = placemark.administrativeArea;
if
(!city) {
// 四大直辖市的城市信息无法通过locality获得,只能通过获取省份的方法来获得(如果city为空,则可知为直辖市)
city = placemark.administrativeArea;
}
NSLog
(@
"当前城市:%@"
,city);
// 设置地图显示的类型及根据范围进行显示 安放大头针
MKPointAnnotation *pinAnnotation = [[MKPointAnnotation alloc] init];
pinAnnotation.coordinate = theCoordinate;
pinAnnotation.title = city;
[_mapView addAnnotation:pinAnnotation];
}
else
if
(error ==
nil
&& [array count] == 0)
{
NSLog
(@
"No results were returned."
);
}
else
if
(error !=
nil
)
{
NSLog
(@
"An error occurred = %@"
, error);
}
}];
}];
}
// 每次添加大头针都会调用此方法 可以设置大头针的样式
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(
id
)annotation
{
// 判断大头针位置是否在原点,如果是则不加大头针
if
([annotation isKindOfClass:[mapView.userLocation
class
]])
return
nil
;
static
NSString
*annotationName = @
"annotation"
;
MKPinAnnotationView *anView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:annotationName];
if
(anView ==
nil
)
{
anView = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:annotationName];
}
anView.animatesDrop =
YES
;
// // 显示详细信息
anView.canShowCallout =
YES
;
// anView.leftCalloutAccessoryView 可以设置左视图
// anView.rightCalloutAccessoryView 可以设置右视图
return
anView;
}
//长按添加大头针事件
- (
void
)lpgrClick:(
UILongPressGestureRecognizer
*)lpgr
{
// 判断只在长按的起始点下落大头针
if
(lpgr.state ==
UIGestureRecognizerStateBegan
)
{
// 首先获取点
CGPoint point = [lpgr locationInView:_mapView];
// 将一个点转化为经纬度坐标
CLLocationCoordinate2D center = [_mapView convertPoint:point toCoordinateFromView:_mapView];
MKPointAnnotation *pinAnnotation = [[MKPointAnnotation alloc] init];
pinAnnotation.coordinate = center;
pinAnnotation.title = @
"长按"
;
[_mapView addAnnotation:pinAnnotation];
}
}
//计算两个位置之间的距离
- (
void
)locationManager:(CLLocationManager *)manager didFailWithError:(
NSError
*)error{
NSLog
(@
"%@"
,error);
}
- (
void
)didReceiveMemoryWarning {
[
super
didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
///////////////////高德地图////////////////////////////
1.在开始开发之前你需要去高德开发者平台去注册,以获取开发你当前应用的apikey
2.假设你已经获取了apikey,接下里我们来进行地图应用的开发
首先,配置工程,笔者这里建议使用cocopods自动配置
编辑的Podfile文件
pod 'AMap3DMap', '2.5.0'
#pod 'AMap2DMap' #2D地图SDK(2D地图和3D地图不能同时使用)
pod 'AMapSearch', '3.3.0' #搜索服务SDK
配置info.plist文件:
(1)需要添加NSLocationWhenInUseUsageDescription 或NSLocationAlwaysUsageDescription 字段,以申请定位权限。
(2)iOS9为了增强数据访问安全,将所有的http请求都改为了https,为了能够在iOS9中正常使用地图SDK,请在"Info.plist"中进行如下配置,否则影响SDK的使用。
<key>NSAppTransportSecuritykey>
<dict>
<key>NSAllowsArbitraryLoadskey>
<true/>
dict>
(3)在iOS9中为了能正常调起高德地图App的功能,必须在"Info.plist"中将高德地图App的URL scheme列为白名单,否则无法调起,配置如下:
<key>LSApplicationQueriesSchemeskey>
<array>
<string>iosamapstring>
array>
3.代码部分:
在ViewController的 .m文件中导入头文件,并把你的apikey定义成宏方便后面使用
#import "ViewController.h"
#import
#import
#define APIKey @"7d4a7b3386ffbef532ff66417b95e7ad"
@interface ViewController ()<MAMapViewDelegate,AMapSearchDelegate,UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong) UITableView *tableView;//显示搜索结果
@property(nonatomic,strong) NSMutableArray *dataArray;//数据源数组
@end
@implementation ViewController
{
MAMapView * _mapView;//地图对象
AMapSearchAPI * _search;//搜索对象
CLLocation * _currentLocation;//坐标位置
}
#pragma mark 地图显示和定位
-(void)initMapView{
[MAMapServices sharedServices].apiKey = APIKey;
_mapView = [[MAMapView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width,self.view.frame.size.height/2.0f)];
_mapView.delegate = self;
[self.view addSubview:_mapView];
}
#pragma mark serach初始化
-(void)initSearch{
[AMapSearchServices sharedServices].apiKey=APIKey;
_search =[[AMapSearchAPI alloc] init];
_search.delegate=self;
}
#pragma mark 逆地理编码
-(void)reGeoCoding{
if (_currentLocation) {
AMapReGeocodeSearchRequest *request =[[AMapReGeocodeSearchRequest alloc] init];
request.location =[AMapGeoPoint locationWithLatitude:_currentLocation.coordinate.latitude longitude:_currentLocation.coordinate.longitude];
[_search AMapReGoecodeSearch:request];
}
}
#pragma mark 搜索请求发起后的回调
/**失败回调*/
-(void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error{
NSLog(@"request: %@------error: %@",request,error);
}
/**成功回调*/
-(void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response{
//我们把编码后的地理位置,显示到 大头针的标题和子标题上
NSString *title =response.regeocode.addressComponent.city;
if (title.length == 0) {
title = response.regeocode.addressComponent.province;
}
_mapView.userLocation.title = title;
_mapView.userLocation.subtitle = response.regeocode.formattedAddress;
}
#pragma mark 初始化tableview
-(void)initTableView{
self.tableView=[[UITableView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height/2.0f, self.view.frame.size.width, self.view.frame.size.height/2.0f) style:UITableViewStylePlain];
self.tableView.delegate=self;
self.tableView.dataSource=self;
[self.view addSubview:self.tableView];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSearch];
[self initMapView];
[self creatUI];
[self initTableView];
_mapView.showsUserLocation = YES; //YES 为打开定位,NO为关闭定位
[_mapView setUserTrackingMode: MAUserTrackingModeFollow animated:YES];
}
#pragma mark 创建界面
-(void)creatUI{
UIButton *searchButton =[UIButton buttonWithType:UIButtonTypeRoundedRect];
searchButton.frame=CGRectMake(80, CGRectGetHeight(_mapView.bounds)-80,40 , 40);
searchButton.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin;
searchButton.backgroundColor=[UIColor whiteColor];
[searchButton setTitle:@"搜索" forState:UIControlStateNormal];
[searchButton addTarget:self
action:@selector(search:) forControlEvents:UIControlEventTouchUpInside];
[_mapView addSubview:searchButton];
}
#pragma mark 搜索点击事件
-(void)search:(UIButton *)sender{
if (_currentLocation==nil||_search==nil) {
NSLog(@"搜索失败");
return;
}
AMapPOIAroundSearchRequest *request=[[AMapPOIAroundSearchRequest alloc] init];
request.location=[AMapGeoPoint locationWithLatitude:_currentLocation.coordinate.latitude longitude:_currentLocation.coordinate.longitude];
request.keywords = @"美食";
[_search AMapPOIAroundSearch:request];
}
#pragma mark 周边搜索回调
-(void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response{
if (response.pois.count>0) {
self.dataArray = [response.pois mutableCopy];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}
}
#pragma mark 懒加载
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray=[[NSMutableArray alloc] init];
}
return _dataArray;
}
#pragma mark UITableViewDataSource&&UITableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSLog(@"%ld",self.dataArray.count);
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *cellID = @"cell";
UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellID];
if (cell==nil) {
cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
}
AMapPOI *poi = self.dataArray[indexPath.row];
cell.textLabel.text = poi.name;
cell.detailTextLabel.text = poi.address;
return cell;
}
#pragma mark 定位更新回调
-(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation
updatingLocation:(BOOL)updatingLocation
{
if(updatingLocation)
{
//取出当前位置的坐标
// NSLog(@"latitude : %f,longitude: %f",userLocation.coordinate.latitude,userLocation.coordinate.longitude);
}
_currentLocation = [userLocation.location copy];
[self reGeoCoding];
}
- (void)cancelAllRequests{
NSLog(@"error");
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
值得一提是,之前用cocopods导入最新版的SDK时,不能找到
[MAMapServices sharedServices].apiKey = APIKey;
[AMapSearchServices sharedServices].apiKey=APIKey;
MAMapServices和AMapSearchServices这两个类,因而也不能调用后面的方法,最后实在没办法,笔者就使用了前一个版本 ,然后就发现有这个类了.......如果哪个大神指导怎么回事请告诉笔者,他日,必有重谢
///////////////////百度地图////////////////////////////
百度地图 iOS SDK是一套基于iOS 5.0及以上版本设备的应用程序接口,不仅提供展示地图的基本接口,还提供POI检索、路径规划、地图标注、离线地图、定位、周边雷达等丰富的LBS能力 。
1.基础地图
2.POI检索
3.定位
1.自动配置.framework形式开发包(使用CocoaPods)<推荐>
2.手动配置.framework形式开发包
1、如果在iOS9中使用了调起百度地图客户端功能,必须在"Info.plist"中进行如下配置,否则不能调起百度地图客户端。
<key>LSApplicationQueriesSchemeskey>
<string>baidumapstring>
2、自iOS SDK v2.5.0起,为了对iOS8的定位能力做兼容,需要在info.plist里添加(以下二选一,两个都添加默认使用 NSLocationWhenInUseUsageDescription):
NSLocationWhenInUseUsageDescription ,允许在前台使用时获取GPS的描述
NSLocationAlwaysUsageDescription ,允许永久使用GPS的描述
3、在使用Xcode6进行SDK开发过程中,需要在info.plist中添加:Bundle display name ,且其值不能为空(Xcode6新建的项目没有此配置,若没有会造成manager start fail
AppDelegate.m文件中添加对BMKMapManager的初始化,并填入申请的授权Key
#import "AppDelegate.h"
#import
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//创建并初始化一个引擎对象
BMKMapManager *manager = [[BMKMapManager alloc] init];
//启动地图引擎
BOOL success = [manager start:@"zBWLNgRUrTp9CVb5Ez6gZpNebljmYylO" generalDelegate:nil];
if (!success) {
NSLog(@"失败");
}
// Override point for customization after application launch.
return YES;
}
#import "ViewController.h"
#import
@interface ViewController ()<BMKMapViewDelegate>
@property (nonatomic,strong) BMKMapView *mapView;//地图视图
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//初始化地图
self.mapView = [[BMKMapView alloc] initWithFrame:self.view.frame];
self.mapView.delegate =self;
//设置地图的显示样式
self.mapView.mapType = BMKMapTypeSatellite;//卫星地图
//设定地图是否打开路况图层
self.mapView.trafficEnabled = YES;
//底图poi标注
self.mapView.showMapPoi = NO;
//在手机上当前可使用的级别为3-21级
self.mapView.zoomLevel = 21;
//设定地图View能否支持旋转
self.mapView.rotateEnabled = NO;
//设定地图View能否支持用户移动地图
self.mapView.scrollEnabled = NO;
//添加到view上
[self.view addSubview:self.mapView];
//还有很多属性,根据需求查看API
}
运行效果入下;
#import "ViewController.h"
#import
#import
@interface ViewController ()<BMKLocationServiceDelegate,BMKMapViewDelegate>
@property (nonatomic,strong) BMKMapView *mapView;//地图视图
@property (nonatomic,strong) BMKLocationService *service;//定位服务
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//初始化地图
self.mapView = [[BMKMapView alloc] initWithFrame:self.view.frame];
self.mapView.delegate =self;
//添加到view上
[self.view addSubview:self.mapView];
//初始化定位
self.service = [[BMKLocationService alloc] init];
//设置代理
self.service.delegate = self;
//开启定位
[self.service startUserLocationService];
// Do any additional setup after loading the view, typically from a nib.
}
#pragma mark -------BMKLocationServiceDelegate
/**
*用户位置更新后,会调用此函数
*@param userLocation 新的用户位置
*/
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation {
//展示定位
self.mapView.showsUserLocation = YES;
//更新位置数据
[self.mapView updateLocationData:userLocation];
//获取用户的坐标
self.mapView.centerCoordinate = userLocation.location.coordinate;
self.mapView.zoomLevel =18;
}
运行结果
#import "ViewController.h"
#import
#import
#import
#import
#import
#import
#define kWidth [UIScreen mainScreen].bounds.size.width
@interface ViewController ()<BMKLocationServiceDelegate,BMKPoiSearchDelegate,BMKMapViewDelegate>
@property (nonatomic,strong) BMKMapView *mapView;//地图视图
@property (nonatomic,strong) BMKLocationService *service;//定位服务
@property (nonatomic,strong) BMKPoiSearch *poiSearch;//搜索服务
@property (nonatomic,strong) NSMutableArray *dataArray;
@end
@implementation ViewController
- (NSMutableArray *)dataArray {
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
- (void)viewDidLoad {
[super viewDidLoad];
//初始化地图
self.mapView = [[BMKMapView alloc] initWithFrame:self.view.frame];
self.mapView.delegate =self;
// //设置地图的显示样式
// self.mapView.mapType = BMKMapTypeSatellite;//卫星地图
//
// //设置路况
// self.mapView.trafficEnabled = YES;
//
// //底图poi标注
// self.mapView.showMapPoi = NO;
//
// //在手机上当前可使用的级别为3-21级
// self.mapView.zoomLevel = 21;
//
// //旋转
// self.mapView.rotateEnabled = NO;
//
// //拖拽
// self.mapView.scrollEnabled = NO;
//
[self.view addSubview:self.mapView];
//初始化定位
self.service = [[BMKLocationService alloc] init];
//设置代理
self.service.delegate = self;
//开启定位
[self.service startUserLocationService];
// Do any additional setup after loading the view, typically from a nib.
}
#pragma mark -------BMKLocationServiceDelegate
/**
*用户位置更新后,会调用此函数
*@param userLocation 新的用户位置
*/
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation {
//展示定位
self.mapView.showsUserLocation = YES;
//更新位置数据
[self.mapView updateLocationData:userLocation];
//获取用户的坐标
self.mapView.centerCoordinate = userLocation.location.coordinate;
self.mapView.zoomLevel =18;
//初始化搜索
self.poiSearch =[[BMKPoiSearch alloc] init];
self.poiSearch.delegate = self;
//初始化一个周边云检索对象
BMKNearbySearchOption *option = [[BMKNearbySearchOption alloc] init];
//索引 默认为0
option.pageIndex = 0;
//页数默认为10
option.pageCapacity = 50;
//搜索半径
option.radius = 200;
//检索的中心点,经纬度
option.location = userLocation.location.coordinate;
//搜索的关键字
option.keyword = @"小吃";
//根据中心点、半径和检索词发起周边检索
BOOL flag = [self.poiSearch poiSearchNearBy:option];
if (flag) {
NSLog(@"搜索成功");
//关闭定位
[self.service stopUserLocationService];
}
else {
NSLog(@"搜索失败");
}
}
#pragma mark -------BMKPoiSearchDelegate
/**
*返回POI搜索结果
*@param searcher 搜索对象
*@param poiResult 搜索结果列表
*@param errorCode 错误号,@see BMKSearchErrorCode
*/
- (void)onGetPoiResult:(BMKPoiSearch *)searcher result:(BMKPoiResult *)poiResult errorCode:(BMKSearchErrorCode)errorCode {
//若搜索成功
if (errorCode ==BMK_SEARCH_NO_ERROR) {
//POI信息类
//poi列表
for (BMKPoiInfo *info in poiResult.poiInfoList) {
[self.dataArray addObject:info];
//初始化一个点的注释 //只有三个属性
BMKPointAnnotation *annotoation = [[BMKPointAnnotation alloc] init];
//坐标
annotoation.coordinate = info.pt;
//title
annotoation.title = info.name;
//子标题
annotoation.subtitle = info.address;
//将标注添加到地图上
[self.mapView addAnnotation:annotoation];
}
}
}
/**
*返回POI详情搜索结果
*@param searcher 搜索对象
*@param poiDetailResult 详情搜索结果
*@param errorCode 错误号,@see BMKSearchErrorCode
*/
- (void)onGetPoiDetailResult:(BMKPoiSearch *)searcher result:(BMKPoiDetailResult *)poiDetailResult errorCode:(BMKSearchErrorCode)errorCode {
NSLog(@"%@",poiDetailResult.name);
}
#pragma mark -------------BMKMapViewDelegate
/**
*根据anntation生成对应的View
*@param mapView 地图View
*@param annotation 指定的标注
*@return 生成的标注View
*/
- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id)annotation {
//如果是注释点
if ([annotation isKindOfClass:[BMKPointAnnotation class]]) {
//根据注释点,创建并初始化注释点视图
BMKPinAnnotationView *newAnnotation = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"an"];
//设置大头针的颜色
newAnnotation.pinColor = BMKPinAnnotationColorRed;
//设置动画
newAnnotation.animatesDrop = YES;
return newAnnotation;
}
return nil;
}
/**
*当选中一个annotation views时,调用此接口
*@param mapView 地图View
*@param views 选中的annotation views
*/
- (void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view {
//poi详情检索信息类
BMKPoiDetailSearchOption *option = [[BMKPoiDetailSearchOption alloc] init];
BMKPoiInfo *info = self.dataArray.firstObject;
//poi的uid,从poi检索返回的BMKPoiResult结构中获取
option.poiUid = info.uid;
/**
*根据poi uid 发起poi详情检索
*异步函数,返回结果在BMKPoiSearchDelegate的onGetPoiDetailResult通知
*@param option poi详情检索参数类(BMKPoiDetailSearchOption)
*@return 成功返回YES,否则返回NO
*/
BOOL flag = [self.poiSearch poiDetailSearch:option];
if (flag) {
NSLog(@"检索成功");
}
else {
NSLog(@"检索失败");
}
}
运行结果
百度地图的功能很强大,还有很多检索,都没有写.大家又兴趣可以钻研下,毕竟第三方的接口文档相对比较明了.如有问题,可以留言