iOS高德地图使用笔记
高德地图笔记
一 准备工作
1.前往高德官网,申请key,http://lbs.amap.com/
2.导入高德SDK,使用cocopods
platform :ios, '7.0' #手机的系统
target 'AMap' do
pod 'AMap3DMap' #3D地图SDK
#pod 'AMap2DMap' #2D地图SDK (2D和3D不能同时使⽤用)
pod 'AMapSearch' #搜索服务SDK
pod 'AMapLocation'
end
二 地图显示
1.AppDelegate.m中倒入#import <AMapFoundationKit/AMapFoundationKit.h>
//配置高德Key
[AMapServices sharedServices].apiKey = @"2a024f9d7c0478c387208cc1c1ae7986";
2.在ViewController中引入#import <MAMapKit/MAMapKit.h>
@property (strong,nonatomic) MAMapView * mapView;
///初始化地图
_mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
//地图中心位置
_mapView.centerCoordinate = CLLocationCoordinate2DMake(37.785834, -122.406417);
// _mapView.zoomLevel 缩放级别(默认3-19,有室内地图时为3-20)
///把地图添加至view
[self.view addSubview:_mapView];
//地图类型
// MAMapTypeStandard = 0, // 普通地图
// MAMapTypeSatellite, // 卫星地图
// MAMapTypeStandardNight, // 夜间视图
// MAMapTypeNavi, // 导航视图
// MAMapTypeBus // 公交视图
_mapView.mapType = arc4random()%5;
三。定位功能
1.打开定位功能
_mapView.showsUserLocation = YES;
2.在info.plist中配置
NSLocationWhenInUseUsageDescription 提示信息
3.在MAMapView的回调方法中获取经纬度坐标
//位置或者设备方向更新后,会调用此函数
-(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation{
_currentLocation = userLocation.location;
NSLog(@"%@",_currentLocation);
}
//当userTrackingMode改变时,调用此接口
- (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated{
if (mode == MAUserTrackingModeNone) {
[_locationBtn setImage:[UIImage imageNamed:@"location2"] forState:UIControlStateNormal];
}else{
[_locationBtn setImage:[UIImage imageNamed:@"location1"] forState:UIControlStateNormal];
}
}
4.定位模式,三种模式//改变用户定位模式
-(void)locationAction{
if (_mapView.userTrackingMode != MAUserTrackingModeFollow) {
//追踪用户的location更新
[_mapView setUserTrackingMode:MAUserTrackingModeFollow animated:YES];
}else{
//不追踪用户的location更新
[_mapView setUserTrackingMode:MAUserTrackingModeNone animated:YES];
}
}
5.逆地理编码(点击当前位置,显示位置信息),调用AMapSearchAPI的逆地理编码请求接口
//初始化搜索
-(void)initSearch{
_search = [[AMapSearchAPI alloc]init];
_search.delegate = self;
}
//逆地理编码查询请求
-(void)reGeoAction{
if (_currentLocation) {
//逆地理编码请求
AMapReGeocodeSearchRequest * request = [[AMapReGeocodeSearchRequest alloc]init];
request.location = [AMapGeoPoint locationWithLatitude:_currentLocation.coordinate.latitude longitude:_currentLocation.coordinate.longitude];
[_search AMapReGoecodeSearch:request];
}
}
#pragma mark - AMapSearchDelegate
//搜索出错时回调
-(void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error{
NSLog(@"request:%@,error:%@",request,error);
}
//地理编码请求搜索正确时返回
-(void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response{
NSLog(@"response:%@",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 - MAMapViewDelegate
//地图上的圆点被选中时调用
-(void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view{
//选中定位AnnotationView时进行逆地理编码查询
if ([view.annotation isKindOfClass:[MAUserLocation class]]) {
[self reGeoAction];
}
}
6.POI周边搜索
//创建搜索按钮
UIButton * searchBtn = [UIButton buttonWithType:UIButtonTypeCustom];
searchBtn.frame = CGRectMake(CGRectGetMaxX(_locationBtn.frame)+30, self.view.frame.size.height-50, 30, 30);
[self.view addSubview:searchBtn];
[searchBtn setImage:[UIImage imageNamed:@"search"] forState:UIControlStateNormal];
searchBtn.layer.cornerRadius = 10;
[searchBtn addTarget:self action:@selector(pressSearch) forControlEvents:UIControlEventTouchUpInside];
//初始化数组
-(void)initDataArr{
_pois = [NSArray array];
_annotations = [NSMutableArray array];
}
//POI周边搜索
-(void)pressSearch{
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 - AMapSearchDelegate
//搜索出错时回调
-(void)AMapSearchRequest:(id)request didFailWithError:(NSError *)error{
NSLog(@"request:%@,error:%@",request,error);
}
//POI周边搜索正确请求回调,将数据传入SearchResultViewController并显示在tableView上,点击cell又将选中的信息返回,并在地图上添加大头针
-(void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response{
NSLog(@"request:%@",request);
NSLog(@"response:%@",response);
if (response.pois.count > 0) {
_pois = response.pois;
//清空标注
[_mapView removeAnnotations:_annotations];
[_annotations removeAllObjects];
SearchResultViewController * vc = [[SearchResultViewController alloc]init];
vc.dataArr = _pois;
vc.chuanCanBlock = ^(AMapPOI * poi){
MAPointAnnotation * annotation = [[MAPointAnnotation alloc]init];
annotation.coordinate = CLLocationCoordinate2DMake(poi.location.latitude, poi.location.longitude);
annotation.title = poi.name;
annotation.subtitle = poi.address;
[_annotations addObject:annotation];
[_mapView addAnnotation:annotation];
};
[self presentViewController:vc animated:YES completion:nil];
}
}
#pragma mark - MAMapViewDelegate
//大头针被点击时创建MAAnnotationView,显示信息,创建类似于TableViewCell复用
-(MAAnnotationView*)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation{
if ([annotation isKindOfClass:[MAPointAnnotation class]]) {
static NSString * reuseIndetifier = @"annotationReuseIndetifier";
MAPinAnnotationView * annotationView = (MAPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseIndetifier];
if (annotationView == nil) {
annotationView = [[MAPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:reuseIndetifier];
}
annotationView.canShowCallout = YES;
return annotationView;
}
return nil;
}
SearchResultViewController类
#import "SearchResultViewController.h"
@interface SearchResultViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) UITableView *tableView;
@end
@implementation SearchResultViewController
-(void)viewDidLoad{
[super viewDidLoad];
[self createNavgationBar];
_tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height-64)];
_tableView.dataSource = self;
_tableView.delegate = self;
[self.view addSubview:_tableView];
}
-(void)createNavgationBar{
//创建一个导航栏
UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
//创建一个导航栏集合
UINavigationItem *navItem = [[UINavigationItem alloc]init];
//在这个集合Item中添加标题,按钮
//style:设置按钮的风格,一共有三种选择
//action:@selector:设置按钮的点击事件
//创建一个左边按钮
UIBarButtonItem *leftButton =[[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(clickLeftButton)];
//创建一个右边按钮
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"右边" style:UIBarButtonItemStylePlain target:self action:@selector(clickLeftButton)];
//设置导航栏的内容
[navItem setTitle:@"餐饮"];
//把导航栏集合添加到导航栏中,设置动画关闭
[navBar pushNavigationItem:navItem animated:NO];
//把左右两个按钮添加到导航栏集合中去
[navItem setLeftBarButtonItem:leftButton];
[navItem setRightBarButtonItem:rightButton];
//将标题栏中的内容全部添加到主视图当中
[self.view addSubview:navBar];
}
-(void)clickLeftButton{
[self dismissViewControllerAnimated:YES completion:nil];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return _dataArr.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 60;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
}
AMapPOI * poi = _dataArr[indexPath.row];
cell.textLabel.text = poi.name;
cell.detailTextLabel.text = poi.address;
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
AMapPOI * poi = _dataArr[indexPath.row];
self.chuanCanBlock(poi);
[self dismissViewControllerAnimated:YES completion:nil];
}
7.自定义MAAnnotationView
属性:
/**
* 关联的annotation
*/
@property (nonatomic, strong) id <MAAnnotation> annotation;
/**
* 显示的image
*/
@property (nonatomic, strong) UIImage *image;
/**
* 默认情况下, annotation view的中心位于annotation的坐标位置,可以设置centerOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是屏幕坐标
*/
@property (nonatomic) CGPoint centerOffset;
/**
* 默认情况下, 弹出的气泡位于view正中上方,可以设置calloutOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是屏幕坐标
*/
@property (nonatomic) CGPoint calloutOffset;
MAPinAnnotationView:提供类似大头针效果的annotation view
//自定义MAAnnotationView
-(MAAnnotationView*)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation{
if ([annotation isKindOfClass:[MAPointAnnotation class]]) {
static NSString * reuseIndetifier = @"annotationReuseIndetifier";
MAPinAnnotationView * annotationView = (MAPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseIndetifier];
if (annotationView == nil) {
annotationView = [[MAPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:reuseIndetifier];
}
//自定义图片
annotationView.image = [UIImage imageNamed:@"annaotation"];
//禁用大头针的气泡弹出
annotationView.canShowCallout = NO;
//设置中心点偏移,使得标注底部中间点成为经纬度对应点
annotationView.centerOffset = CGPointMake(0, -18);
return annotationView;
}
return nil;
}
8.自定义callout (气泡)
气泡其实就是一个view,自定义气泡就是自定义一个View,首先自定义annotationView,继承自MAAnnotationView,将自定义的callout作为一个属性,在选中时实现父类的方法
#pragma mark - MAMapViewDelegate
//自定义MAAnnotationView
-(MAAnnotationView*)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation{
if ([annotation isKindOfClass:[MAPointAnnotation class]]) {
static NSString * reuseIndetifier = @"annotationReuseIndetifier";
CustomAnnotationView * annotationView = (CustomAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseIndetifier];
if (annotationView == nil) {
annotationView = [[CustomAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:reuseIndetifier];
}
//自定义图片
annotationView.image = [UIImage imageNamed:@"annaotation"];
//禁用系统大头针的气泡弹出
annotationView.canShowCallout = NO;
//设置中心点偏移,使得标注底部中间点成为经纬度对应点
annotationView.centerOffset = CGPointMake(0, -18);
return annotationView;
}
return nil;
}
自定义的气泡CustomCalloutView
@interface CustomCalloutView : UIView
@property (strong,nonatomic) NSString * title;
@property (strong,nonatomic) NSString * subTitle;
@property (strong,nonatomic) UIImage * image;
@end
#import "CustomCalloutView.h"
#define kArrorHeight 10
#define kPortraitMargin 5
#define kPortraitWidth 70
#define kPortraitHeight 50
#define kTitleWidth 120
#define kTitleHeight 20
@interface CustomCalloutView ()
@property (strong,nonatomic) UIImageView * portraitView;
@property (strong,nonatomic) UILabel * subtitleLabel;
@property (strong,nonatomic) UILabel * titleLabel;
@end
@implementation CustomCalloutView
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.userInteractionEnabled = NO;
[self initSubViews];
}
return self;
}
-(void)initSubViews{
//添加图片
self.portraitView = [[UIImageView alloc]initWithFrame:CGRectMake(kPortraitMargin, kPortraitMargin, kPortraitWidth, kPortraitHeight)];
self.portraitView.backgroundColor = [UIColor blueColor];
[self addSubview:self.portraitView];
//添加标题
self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(kPortraitMargin * 2+kPortraitWidth, kPortraitMargin, kTitleWidth, kTitleHeight)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:14];
self.titleLabel.textColor = [UIColor whiteColor];
self.titleLabel.text = @"title";
[self addSubview:self.titleLabel];
//地址
self.subtitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(kPortraitMargin * 2+kPortraitWidth, kPortraitMargin*2+kTitleHeight, kTitleWidth, kTitleHeight)];
self.subtitleLabel.font = [UIFont boldSystemFontOfSize:12];
self.subtitleLabel.textColor = [UIColor lightGrayColor];
self.subtitleLabel.text = @"subtitleLabel";
[self addSubview:self.subtitleLabel];
}
-(void)setTitle:(NSString *)title{
self.titleLabel.text = title;
}
-(void)setSubTitle:(NSString *)subTitle{
self.subtitleLabel.text = subTitle;
}
-(void)setImage:(UIImage *)image{
self.portraitView.image = image;
}
#pragma mark - drawRect绘制气泡背景
-(void)drawRect:(CGRect)rect{
[self drawInContext:UIGraphicsGetCurrentContext()];
self.layer.shadowColor = [UIColor blackColor].CGColor;
self.layer.shadowOpacity = 1.0;
self.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
}
-(void)drawInContext:(CGContextRef)context{
CGContextSetLineWidth(context, 2.0);//线宽
CGContextSetFillColorWithColor(context, [UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:0.8].CGColor);//填充颜色
[self getDrawPath:context];
CGContextFillPath(context);
}
-(void)getDrawPath:(CGContextRef)context{
#define kArrorHeight 10
CGRect rrect = self.bounds;
CGFloat radius = 6.0;
CGFloat minx = CGRectGetMinX(rrect),
midx = CGRectGetMidX(rrect),
maxx = CGRectGetMaxX(rrect);
CGFloat miny = CGRectGetMinY(rrect),
maxy = CGRectGetMaxY(rrect) - kArrorHeight;
CGContextMoveToPoint(context, midx+kArrorHeight, maxy);
CGContextAddLineToPoint(context, midx, maxy+kArrorHeight);
CGContextAddLineToPoint(context, midx-kArrorHeight, maxy);
CGContextAddArcToPoint(context, minx, maxy, minx, miny, radius);
CGContextAddArcToPoint(context, minx, miny, maxx, miny, radius);
CGContextAddArcToPoint(context, maxx, miny, maxx, maxy, radius);
CGContextAddArcToPoint(context, maxx, maxy, minx, maxy, radius);
CGContextClosePath(context);
}
@end
自定义的AnnotationView
h文件
#import "CustomCalloutView.h"
@interface CustomAnnotationView : MAAnnotationView
@property (readonly,nonatomic) CustomCalloutView * calloutView;
@end
m文件
#import "CustomAnnotationView.h"
@interface CustomAnnotationView ()
@property (strong,nonatomic,readwrite) CustomCalloutView * calloutView;
@end
@implementation CustomAnnotationView
@synthesize calloutView = _calloutView;
#pragma mark - 重写父类的选种方法
-(void)setSelected:(BOOL)selected animated:(BOOL)animated{
if (self.selected == selected) {
return;
}
if (selected) {
if (self.calloutView == nil) {
#define kCalloutWidth 200.0
#define kCalloutHeight 70.0
self.calloutView = [[CustomCalloutView alloc]initWithFrame:CGRectMake(0, 0, kCalloutWidth, kCalloutHeight)];
self.calloutView.center = CGPointMake(CGRectGetWidth(self.bounds)/2.f+self.calloutOffset.x, -CGRectGetHeight(self.calloutView.bounds)/2.f+self.calloutOffset.y);
}
self.calloutView.title = self.annotation.title;
self.calloutView.subTitle = self.annotation.subtitle;
NSString * imageName = [NSString stringWithFormat:@"jiudian%d",arc4random()%3+1];
self.calloutView.image = [UIImage imageNamed:imageName];
[self addSubview:self.calloutView];
}else{
[self.calloutView removeFromSuperview];
}
[super setSelected:selected animated:animated];
}
#pragma mark - 重写父类的方法,用以实现点击callotView判断为点击该annotationView
-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
BOOL inside = [super pointInside:point withEvent:event];
if (!inside && self.selected) {
inside = [self.calloutView pointInside:[self convertPoint:point toView:self.calloutView] withEvent:event];
}
return inside;
}
@end
8.路线规划
1.长按手势添加目的地
取得手势屏幕坐标,转换为经纬度坐标,获得目的地的经纬度,在MAMapView中有坐标转换接口
//初始化手势
_recognizer = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(clickLongRecognizer:)];
_recognizer.delegate = self;
[_mapView addGestureRecognizer:_recognizer];
2.坐标转换,添加目的地
//长按手势事件
-(void)clickLongRecognizer:(UILongPressGestureRecognizer*)recognizer{
if (recognizer.state == UIGestureRecognizerStateBegan) {
//将指定view坐标系的坐标转换为经纬度
CLLocationCoordinate2D coordinate = [_mapView convertPoint:[recognizer locationInView:_mapView] toCoordinateFromView:_mapView];
//添加标注
if (_destinationPoint != nil) {
//清理
[_mapView removeAnnotation:_destinationPoint];
_destinationPoint = nil;
}
_destinationPoint = [[MAPointAnnotation alloc]init];
_destinationPoint.coordinate = coordinate;
_destinationPoint.title = @"目的地";
[_mapView addAnnotation:_destinationPoint];
}
}
3.搜索路线
//路线规划按钮事件
-(void)pressSearchPath{
if (_currentLocation == nil || _destinationPoint == nil || _search == nil) {
NSLog(@"路线规划失败");
return;
}
//步行路径规划
AMapWalkingRouteSearchRequest * request = [[AMapWalkingRouteSearchRequest alloc]init];
request.multipath = 1;//是否提供备选步行方案: 0-只提供一条步行方案; 1-提供备选步行方案(有可能无备选方案)
request.origin = [AMapGeoPoint locationWithLatitude:_currentLocation.coordinate.latitude longitude:_currentLocation.coordinate.longitude];//出发点
request.destination = [AMapGeoPoint locationWithLatitude:_destinationPoint.coordinate.latitude longitude:_destinationPoint.coordinate.longitude];//目的地
//search请求
[_search AMapWalkingRouteSearch:request];
}
#pragma mark - AMapSearchDelegate
//路径规划查询回调
-(void)onRouteSearchDone:(AMapRouteSearchBaseRequest *)request response:(AMapRouteSearchResponse *)response{
if (response.count > 0) {
[_mapView removeOverlays:_pathPolyLines];
_pathPolyLines = nil;
}
//只显示一条
_pathPolyLines = [self polylinesForPath:response.route.paths[0]];
[_mapView addOverlays:_pathPolyLines];//作为覆盖物添加到地图上
[_mapView showAnnotations:@[_destinationPoint,_mapView.userLocation] animated:YES];
}
- (NSArray *)polylinesForPath:(AMapPath *)path
{
NSLog(@"%@",path);
if (path == nil || path.steps.count == 0)
{
return nil;//如果path=nil或者导航路段数为零
}
NSMutableArray *polylines = [NSMutableArray array];
[path.steps enumerateObjectsUsingBlock:^(AMapStep *step, NSUInteger idx, BOOL *stop) {
NSUInteger count = 0;
CLLocationCoordinate2D *coordinates = [self coordinatesForString:step.polyline coordinateCount:&count parseToken:@";"];
//根据经纬度坐标数据生成多段线
MAPolyline *polyline = [MAPolyline polylineWithCoordinates:coordinates count:count];
[polylines addObject:polyline];
free(coordinates), coordinates = NULL;
}];
return polylines;
}
- (CLLocationCoordinate2D *)coordinatesForString:(NSString *)string coordinateCount:(NSUInteger *)coordinateCount parseToken:(NSString *)token{
if (string == nil)
{
return NULL;
}
if (token == nil)
{
token = @",";
}
NSString *str = @"";
if (![token isEqualToString:@","])
{
str = [string stringByReplacingOccurrencesOfString:token withString:@","];
}
else
{
str = [NSString stringWithString:string];
}
NSArray *components = [str componentsSeparatedByString:@","];
NSUInteger count = [components count] / 2;
if (coordinateCount != NULL)
{
*coordinateCount = count;
}
CLLocationCoordinate2D *coordinates = (CLLocationCoordinate2D*)malloc(count * sizeof(CLLocationCoordinate2D));
for (int i = 0; i < count; i++)
{
coordinates[i].longitude = [[components objectAtIndex:2 * i] doubleValue];
coordinates[i].latitude = [[components objectAtIndex:2 * i + 1] doubleValue];
}
return coordinates;
}
4.绘制路线
/**
* @brief 根据overlay生成对应的Renderer
* @param mapView 地图View
* @param overlay 指定的overlay
* @return 生成的覆盖物Renderer
*/
- (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id <MAOverlay>)overlay{
if ([overlay isKindOfClass:[MAPolyline class]]) {
MAPolylineRenderer *polylineRenderer = [[MAPolylineRenderer alloc] initWithPolyline:overlay];
polylineRenderer.lineWidth = 8;
polylineRenderer.lineDash = NO;
polylineRenderer.strokeColor = [UIColor redColor];
polylineRenderer.lineJoinType = kMALineJoinRound;
polylineRenderer.lineCapType = kMALineCapRound;
return polylineRenderer;
}
return nil;
}
iOS高德地图使用笔记相关推荐
- flutter引入高德地图_Flutter笔记-调用原生IOS高德地图sdk
一.前言 2017年底因公司业务组合部门调整,新的团队部分维护的项目用React Native技术混合开发.为适应环境变化,开启疯狂RN学习之旅,晚上回来啃资料看视频.可能由于本身对RN技术体验不感冒 ...
- iOS高德地图路径选择
新公司的一个物流项目用到了高德地图的路径规划导航.之前没用过高德的路径规划,最麻烦的是画出路径,以及多路径情况下的点击选择路径. 其实画出路径的算法在高德地图的相关demo里面有,只要抠出来就行.我要 ...
- [iOS]高德地图SDK开发--准备篇
本文是对高德地图SDK使用的总结,对于高德地图不做过多介绍,可直接登录其官网开放平台进行了解; PS: 这里主要是讲解地图使用的准备工作,最后,以显示地图并定位到当前位置来验证;对于其他的使用,可参看 ...
- iOS 高德地图开发详解
Demo地址 如果有所帮助记得关注,点Star demo中添加了查看路况功能,如果不需要,可以删除. ##一:基本地图功能实现 ####1.申请密钥流程 申请密钥链接 2.配置环境(重点) 高德地图提 ...
- iOS 高德地图(二)(进阶具体使用的细节)
2019独角兽企业重金招聘Python工程师标准>>> 前面我们配置好了SDK的环境,也在高德的官网中申请了AppKey:de5b39fb2b066ed80c51383bb3a1fe ...
- iOS 高德地图处理左下角小图标
1.设置小图标的位置 _mainMapView.logoCenter = CGPointMake(110, 10); 这个可以设置坐标,但是这个方法只限定坐标在可见范围之内,所以这个方法是调整小图标位 ...
- iOS高德地图 多个大头针显示图片 点击效果
最近做一款有关地图的软件 使用到了高德地图 将一些经验记录下来 第一篇博客 以后会陆续更新 希望看到的朋友多多支持啦. 导入等过程PASS掉. 新建一个类 继承 MAPointAnnotati ...
- iOS 高德地图 百度地图 以及苹果自带的地图URI的使用 以及CLLocationManager的使用
1.CLLocationManager的使用 1.首先Xcode导入一个自己带的官方头文件在任意一个类.h #import<MapKit/MapKit.h> 并遵守两协议 <CLLo ...
- IOS 高德地图获取用户导航路径
标题 最近项目里有一个需求,用户开始导航之后,要将导航的路径传到服务器,在另一个客户端显示所有用户的导航路径. ## 思路 ## 要实现这个功能,最关键的一点就是当用户导航之后如何取到路径.笔者是用的 ...
最新文章
- github下载速度改善
- 常见面试题学习(1)
- 基于深度学习的Person Re-ID(综述)
- 06-1. 简单计算器(20)
- chrome表单自动填充去掉input黄色背景
- git 撤销全部的commit_git 撤销commit
- 人生的84000种可能
- weblogic 故障转移
- python的可变参数 *args 和关键字参数**kw
- 计算机接口及应用技术,计算机接口技术及应用 第9讲 控制网络技术(2 现场总线).pdf...
- 虚拟服务器ftp上传权限设置,13. 为 FTP虚拟用户设置“不同文件目录”和“访问权限”...
- JDK 8.0 新特性——函数式接口和Lambda 表达式
- Java 连接 Memcached 服务
- linux docker安装_Linux -- Docker安装
- labview高级视频150讲下载_视频剪辑篇|讲真的,这些软件素材资源我真舍不得分享!(附下载包)...
- tracert/traceroute原理
- html16进制颜色三位,十六进制RGB颜色表
- 移动前端开发的一些简单分类!
- SQLSERVER月份简写转数字
- 悲情陨落的十大民族品牌
热门文章
- 面试总结应届生必须在学校就找好工作不然你会后悔的
- kvm安装ubuntu虚拟机错误总结
- PostgreSQL连接报错:could not connect to server: Connection refused (0x0000274D/10061)
- 微信营销 分享最新的微信营销的几种方式
- cordova操作Android本地文件系统
- java 日历算法_Java实现 蓝桥杯VIP 算法提高 任意年月日历输出
- 计算机专业 845,2021年浙江工商大学硕士研究生自命题845计算机基础综合考研大纲...
- html转换wma,WMA格式转换器(Boxoft All to WMA Converter)
- Excel拼接单元格内容
- 定义全局变量的几种方式