博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
百度地图之基础地图
阅读量:6997 次
发布时间:2019-06-27

本文共 6395 字,大约阅读时间需要 21 分钟。

在做项目集成百度地图SDK时,配置开发环境时,可以下载全新.framework形式静态库,传统.a形式静态库,在用.a形式静态库时在第二步需要引入静态库文件 ,由于有模拟器和真机两个静态库,集成文档写了三种引入,第二种需要讲两个静态库合并,集成文档写的也很清楚,自己也算是比照着集成文档按部就班的操作就可以了。具体请参考:http://developer.baidu.com/map/index.php?title=iossdk 在这我也就是操作记录一下。下面是.a 静态库的合并

下面是framework的合并 两者区别:.a是生成到一个新.a  .framework的生成时覆盖旧的

////  ViewController.m//  baiDuDemo////  Created by City--Online on 15/5/26.//  Copyright (c) 2015年 XQB. All rights reserved.//#import "ViewController.h"#import "BMKMapView.h"#import "BMapKit.h"@interface ViewController ()
@property(nonatomic,strong)BMKMapView *mapView;@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; _mapView=[[BMKMapView alloc]initWithFrame:self.view.bounds]; //地图类型 _mapView.mapType=BMKMapTypeStandard; //实时路况// _mapView.trafficEnabled=YES; //城市热力图// _mapView.baiduHeatMapEnabled=YES; // CLLocationCoordinate2D coor; coor.latitude=22.5538; coor.longitude=114.0672; //设置中心点 _mapView.centerCoordinate=coor; // 添加折线覆盖物 CLLocationCoordinate2D coors[2] = {0}; coors[0].latitude = 22.7538; coors[0].longitude = 114.0672; coors[1].latitude = 23.0538; coors[1].longitude = 114.2672; BMKPolyline* polyline = [BMKPolyline polylineWithCoordinates:coors count:2]; [_mapView addOverlay:polyline]; //添加弧线覆盖物 //传入的坐标顺序为起点、途经点、终点 CLLocationCoordinate2D coords[3] = {0}; coords[0].latitude = 22.7538; coords[0].longitude = 114.0672; coords[1].latitude = 22.3538; coords[1].longitude = 114.2672; coords[2].latitude = 22.0538; coords[2].longitude = 114.2872; BMKArcline *arcline = [BMKArcline arclineWithCoordinates:coords]; [_mapView addOverlay:arcline]; // 添加多边形覆盖物 CLLocationCoordinate2D coorss[3] = {0}; coorss[0].latitude = 22.7538; coorss[0].longitude = 114.0672; coorss[1].latitude = 22.3538; coorss[1].longitude = 114.2672; coorss[2].latitude = 22.0538; coorss[2].longitude = 114.2872; BMKPolygon* polygon = [BMKPolygon polygonWithCoordinates:coorss count:3]; [_mapView addOverlay:polygon]; // 添加圆形覆盖物 CLLocationCoordinate2D coorcircle; coorcircle.latitude = 22.5538; coorcircle.longitude = 114.0672; BMKCircle* circle = [BMKCircle circleWithCenterCoordinate:coorcircle radius:5000]; [_mapView addOverlay:circle]; //添加图片图层覆盖物(第一种:根据指定经纬度坐标生成) CLLocationCoordinate2D coorground; coorground.latitude = 22.0038; coorground.longitude = 114.0672; BMKGroundOverlay* ground = [BMKGroundOverlay groundOverlayWithPosition:coorground zoomLevel:11 anchor:CGPointMake(0.0f,0.0f) icon:[UIImage imageNamed:@"1.jpg"]]; [_mapView addOverlay:ground]; //添加图片图层覆盖物(第二种:根据指定区域生成) CLLocationCoordinate2D coordground[2] = {0}; coordground[0].latitude = 22.2538; coordground[0].longitude = 114.0672; coordground[1].latitude = 22.2038; coordground[1].longitude = 114.1072; BMKCoordinateBounds bound; bound.southWest = coordground[0]; bound.northEast = coordground[1]; BMKGroundOverlay* ground2 = [BMKGroundOverlay groundOverlayWithBounds: bound icon:[UIImage imageNamed:@"1.jpg"]]; [_mapView addOverlay:ground2]; [self.view addSubview:_mapView]; }//根据overlay生成对应的View- (BMKOverlayView *)mapView:(BMKMapView *)mapView viewForOverlay:(id
)overlay{ if ([overlay isKindOfClass:[BMKPolyline class]]){ BMKPolylineView* polylineView = [[BMKPolylineView alloc] initWithOverlay:overlay] ; polylineView.strokeColor = [[UIColor redColor] colorWithAlphaComponent:1]; polylineView.lineWidth = 5.0; return polylineView; } else if ([overlay isKindOfClass:[BMKArcline class]]) { BMKArclineView* arclineView = [[BMKArclineView alloc] initWithOverlay:overlay] ; arclineView.strokeColor = [[UIColor blueColor] colorWithAlphaComponent:0.5]; arclineView.lineWidth = 5.0; return arclineView; } else if ([overlay isKindOfClass:[BMKPolygon class]]){ BMKPolygonView* polygonView = [[BMKPolygonView alloc] initWithOverlay:overlay]; polygonView.strokeColor = [[UIColor purpleColor] colorWithAlphaComponent:1]; polygonView.fillColor = [[UIColor cyanColor] colorWithAlphaComponent:0.2]; polygonView.lineWidth = 5.0; return polygonView; } else if ([overlay isKindOfClass:[BMKCircle class]]){ BMKCircleView* circleView = [[BMKCircleView alloc] initWithOverlay:overlay]; circleView.fillColor = [[UIColor cyanColor] colorWithAlphaComponent:0.5]; circleView.strokeColor = [[UIColor yellowColor] colorWithAlphaComponent:0.5]; circleView.lineWidth = 10.0; return circleView; } else if ([overlay isKindOfClass:[BMKGroundOverlay class]]){ BMKGroundOverlayView* groundView = [[BMKGroundOverlayView alloc] initWithOverlay:overlay] ; groundView.backgroundColor=[UIColor yellowColor]; return groundView; } return nil;}-(void)viewDidAppear:(BOOL)animated{ BMKPointAnnotation *pointAnnotation=[[BMKPointAnnotation alloc]init]; CLLocationCoordinate2D coor; coor.latitude=22.5538; coor.longitude=114.0672; pointAnnotation.coordinate=coor; pointAnnotation.title=@"这里是少年宫"; [_mapView addAnnotation:pointAnnotation]; //移除大头针// if (annotation != nil) {// [_mapView removeAnnotation:annotation];// }}//添加大头针- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id
)annotation{ if ([annotation isKindOfClass:[BMKPointAnnotation class]]) { BMKPinAnnotationView *newAnnotationView = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myAnnotation"]; newAnnotationView.pinColor = BMKPinAnnotationColorPurple; newAnnotationView.animatesDrop = YES;// 设置该标注点动画显示 return newAnnotationView; } return nil;}-(void)viewWillAppear:(BOOL)animated{ [_mapView viewWillAppear]; _mapView.delegate=self;}-(void)viewWillDisappear:(BOOL)animated{ [_mapView viewWillDisappear]; _mapView.delegate=nil;}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end

转载地址:http://awcvl.baihongyu.com/

你可能感兴趣的文章
Spring aop 切面编程
查看>>
C3P0连接池使用教程
查看>>
数据结构——红黑树
查看>>
高通平台MSM8916LCM模块移植(一)-bootloader部分【转】
查看>>
oracle表空间不足相关问题解决办法
查看>>
CentOS-7 在windows server 2012下的虚拟机安装教程
查看>>
函数调用过程栈帧变化详解
查看>>
Android项目实战(三十二):圆角对话框Dialog
查看>>
Word或Excel里画柱状图和折线图组合体
查看>>
[TypeScript] Create a fluent API using TypeScript classes
查看>>
秒杀多线程
查看>>
[原]win10下编译lua5.3.4
查看>>
spring List,Set,Map,Properties,array的配置文件注入方式
查看>>
Fireworks层与蒙版的概念和用法
查看>>
python os.listdir
查看>>
蓝桥杯历届试题题解1
查看>>
Linux C 创建目录函数mkdir相关【转】
查看>>
【js 正则表达式】记录所有在js中使用正则表达式的情况
查看>>
又见关系并查集 以POJ 1182 食物链为例
查看>>
Sql server的Merge语句,源表中如果有重复数据会导致执行报错
查看>>