高德地图SDK(导航)  V7.7.0
MAMapView Class Reference

#import <MAMapView.h>

Inheritance diagram for MAMapView:

Instance Methods

(BOOL skyModelEnable) - __attribute
 是否支持天空模式,默认为YES. 开启后,进入天空模式后,annotation重用可视范围会缩减 More...
 
(CGFloat trafficRatio) - __attribute
 设置实时交通线宽系数,默认线宽系数为0.8,范围为0 - 1 More...
 
(void) - setRegion:animated:
 设定当前地图的经纬度范围,该范围可能会被调整为适合地图窗口显示的范围 More...
 
(MACoordinateRegion- regionThatFits:
 根据当前地图视图frame的大小调整region范围 More...
 
(void) - setVisibleMapRect:animated:
 设置可见区域 More...
 
(MAMapRect- mapRectThatFits:
 重新计算可见地图矩形区域,使之匹配mapview长宽比 More...
 
(MAMapRect- mapRectThatFits:edgePadding:
 根据边缘插入来调整地图矩形区域,使之匹配mapview加insets后的长宽比 More...
 
(void) - setVisibleMapRect:edgePadding:animated:
 设置可见地图矩形区域 More...
 
(void) - setCenterCoordinate:animated:
 设置当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化 More...
 
(void) - setZoomLevel:animated:
 设置缩放级别(默认3-19,有室内地图时为3-20) More...
 
(void) - setZoomLevel:atPivot:animated:
 根据指定的枢纽点来缩放地图 More...
 
(void) - setRotationDegree:animated:duration:
 设置地图旋转角度(逆时针为正向) More...
 
(void) - setCameraDegree:animated:duration:
 设置地图相机角度(范围为[0.f, 60.f],但高于40度的角度需要在16级以上才能生效) More...
 
(MAMapStatus *) - getMapStatus
 获取地图状态 More...
 
(void) - setMapStatus:animated:
 设置地图状态 More...
 
(void) - setMapStatus:animated:duration:
 设置地图状态 More...
 
(void) - setCompassImage:
 设置指南针的图片 More...
 
(UIImage *) - takeSnapshotInRect:
 在指定区域内截图(默认会包含该区域内的annotationView),注意不要在地图回调方法内直接调用 More...
 
(void) - takeSnapshotInRect:withCompletionBlock:
 异步在指定区域内截图(默认会包含该区域内的annotationView), 地图载入完整时回调 More...
 
(double) - metersPerPointForZoomLevel:
 在指定的缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米). More...
 
(CGPoint) - convertCoordinate:toPointToView:
 将经纬度转换为指定view坐标系的坐标 More...
 
(CLLocationCoordinate2D) - convertPoint:toCoordinateFromView:
 将指定view坐标系的坐标转换为经纬度 More...
 
(CGRect) - convertRegion:toRectToView:
 将经纬度region转换为指定view坐标系的rect More...
 
(MACoordinateRegion- convertRect:toRegionFromView:
 将指定view坐标系的rect转换为经纬度region More...
 
(void) - reloadMap
 重新加载地图 More...
 
(void) - clearDisk
 清除所有磁盘上缓存的地图数据(不包括离线地图) More...
 
(void) - reloadInternalTexture
 重新加载内部纹理,在纹理被错误释放时可以执行此方法。(since 5.4.0) More...
 
(NSString *) - mapContentApprovalNumber
 获取地图审图号。如果启用了“自定义样式”功能(customMapStyleEnabled 为 YES),则返回nil。(since 5.4.0) More...
 
(NSString *) - satelliteImageApprovalNumber
 获取卫星图片审图号。(since 5.4.0) More...
 
(void) - addAnimationWith:zoomAnimation:rotateAnimation:cameraDegreeAnimation:
 添加CAKeyframeAnimation动画。(since 6.0.0) More...
 
(void) - forceRefresh
 强制刷新。(since 6.0.0) More...
 
(void) - setConstructingRoadEnable:
 设置在建道路图层是否显示。默认NO(since 7.7.0) More...
 
(void) - addAnnotation:
 向地图窗口添加标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View More...
 
(void) - addAnnotations:
 向地图窗口添加一组标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View More...
 
(void) - removeAnnotation:
 移除标注 More...
 
(void) - removeAnnotations:
 移除一组标注 More...
 
(NSSet *) - annotationsInMapRect:
 获取指定投影矩形范围内的标注 More...
 
(MAAnnotationView *) - viewForAnnotation:
 根据标注数据获取标注view More...
 
(MAAnnotationView *) - dequeueReusableAnnotationViewWithIdentifier:
 从复用内存池中获取制定复用标识的annotation view More...
 
(void) - selectAnnotation:animated:
 选中标注数据对应的view。注意:如果annotation对应的annotationView因不在屏幕范围内而被移入复用池,为了完成选中操作,会将对应的annotationView添加到地图上,并将地图中心点移至annotation.coordinate的位置。 More...
 
(void) - deselectAnnotation:animated:
 取消选中标注数据对应的view More...
 
(void) - showAnnotations:animated:
 设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。 More...
 
(void) - showAnnotations:edgePadding:animated:
 设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。 More...
 
(void) - setCustomMapStyleWithWebData:
 根据web导出数据设置地图样式, 目前仅支持自定义标准类型. 默认不生效,调用customMapStyleEnabled=YES使生效. since 5.2.0 More...
 
(void) - setCustomTextureResourcePath:
 设置自定义纹理. since 5.7.0 More...
 
(void) - setCustomMapStyleID:
 自定义地图样式id, 官网发布后下次开启自定义样式便可生效,目前仅支持自定义标准类型. 默认不生效,调用customMapStyleEnabled=YES使生效. since 6.0.0 More...
 
(void) - setCustomMapStyleOptions:
 自定义地图样式设置,可以支持分级样式配置,如控制不同级别显示不同的颜色(自7.0.0开始样式有更新,旧的样式文件不能继续使用,必须到官网重新导出新样式文件。 自6.6.0开始使用新版样式,旧版样式无法在新版接口setCustomMapStyleOptions:(MAMapCustomStyleOptions *)styleOptions中使用,请到官网(lbs.amap.com)更新新版样式文件.) More...
 
(void) - setIndoorMapControlOrigin:
 设置默认室内地图控件位置 More...
 
(void) - setCurrentIndoorMapFloorIndex:
 设置当前室内地图楼层数 More...
 
(void) - clearIndoorMapCache
 清空室内地图缓存 More...
 
(NSArray *) - overlaysInLevel:
 取位于level下的overlays More...
 
(void) - addOverlay:
 向地图窗口添加Overlay。 需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer。 默认添加层级:MAGroundOverlay默认层级为MAOverlayLevelAboveRoads,其余overlay类型默认层级为MAOverlayLevelAboveLabels More...
 
(void) - addOverlays:
 向地图窗口添加一组Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer 默认添加层级:MAOverlayLevelAboveLabels More...
 
(void) - addOverlay:level:
 向地图窗口添加Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer More...
 
(void) - addOverlays:level:
 向地图窗口添加一组Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer More...
 
(void) - removeOverlay:
 移除Overlay More...
 
(void) - removeOverlays:
 移除一组Overlay More...
 
(void) - insertOverlay:atIndex:level:
 在指定层级的指定的索引处添加一个Overlay More...
 
(void) - insertOverlay:aboveOverlay:
 在指定的Overlay之上插入一个overlay More...
 
(void) - insertOverlay:belowOverlay:
 在指定的Overlay之下插入一个overlay More...
 
(void) - insertOverlay:atIndex:
 在指定的索引处添加一个Overlay More...
 
(void) - exchangeOverlayAtIndex:withOverlayAtIndex:
 在MAOverlayLevelAboveLabels上交换指定索引处的Overlay More...
 
(void) - exchangeOverlayAtIndex:withOverlayAtIndex:atLevel:
 交换指定索引处的Overlay More...
 
(void) - exchangeOverlay:withOverlay:
 交换两个overlay More...
 
(MAOverlayRenderer *) - rendererForOverlay:
 查找指定overlay对应的Renderer,如果该View尚未创建,返回nil More...
 
(void) - showOverlays:animated:
 设置地图使其可以显示数组中所有的overlay, 如果数组中只有一个则直接设置地图中心为overlay的位置。 More...
 
(void) - showOverlays:edgePadding:animated:
 设置地图使其可以显示数组中所有的overlay, 如果数组中只有一个则直接设置地图中心为overlay的位置。 More...
 
(NSArray *) - getHittedPolylinesWith:traverseAll:
 获取点击选中的polylineRenderer, 注意:开启polylineRenderer的点击选中功能,需设置userInteractionEnabled=YES。since 7.1.0 More...
 
(void) - setUserTrackingMode:animated:
 设置定位用户位置的模式 More...
 
(void) - updateUserLocationRepresentation:
 设定UserLocationView样式。如果用户自定义了userlocation的annotationView,或者该annotationView还未添加到地图上,此方法将不起作用 More...
 

Properties

id< MAMapViewDelegatedelegate
 地图view的delegate More...
 
MAMapType mapType
 地图类型 More...
 
CLLocationCoordinate2D centerCoordinate
 当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化 More...
 
MACoordinateRegion region
 当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围 More...
 
MAMapRect visibleMapRect
 可见区域, 设定的该范围可能会被调整为适合地图窗口显示的范围 More...
 
MACoordinateRegion limitRegion
 设置可见地图区域的矩形边界,如限制地图只显示北京市范围 More...
 
MAMapRect limitMapRect
 设置可见地图区域的矩形边界,如限制地图只显示北京市范围 More...
 
CGFloat zoomLevel
 缩放级别(默认3-19,有室内地图时为3-20) More...
 
CGFloat minZoomLevel
 最小缩放级别 More...
 
CGFloat maxZoomLevel
 最大缩放级别(有室内地图时最大为20,否则为19) More...
 
CGFloat rotationDegree
 设置地图旋转角度(逆时针为正向) More...
 
CGFloat cameraDegree
 设置地图相机角度(范围为[0.f, 60.f],但高于40度的角度需要在16级以上才能生效) More...
 
BOOL zoomingInPivotsAroundAnchorPoint
 是否以screenAnchor点作为锚点进行缩放,默认为YES。如果为NO,则以手势中心点作为锚点 More...
 
BOOL zoomEnabled
 是否支持缩放, 默认YES More...
 
BOOL scrollEnabled
 是否支持平移, 默认YES More...
 
BOOL rotateEnabled
 是否支持旋转, 默认YES More...
 
BOOL rotateCameraEnabled
 是否支持camera旋转, 默认YES More...
 
BOOL showsBuildings
 是否显示楼块,默认为YES More...
 
BOOL showsLabels
 是否显示底图标注, 默认为YES More...
 
BOOL showTraffic
 是否显示交通路况图层, 默认为NO More...
 
NSDictionary< NSNumber *, UIColor * > * trafficStatus
 设置实时交通颜色,key为 MATrafficStatus More...
 
BOOL touchPOIEnabled
 是否支持单击地图获取POI信息(默认为YES), 对应的回调是 -(void)mapView:(MAMapView *) didTouchPois:(NSArray *) More...
 
BOOL showsCompass
 是否显示指南针, 默认YES More...
 
CGPoint compassOrigin
 指南针原点位置 More...
 
CGSize compassSize
 指南针的宽高 More...
 
BOOL showsScale
 是否显示比例尺, 默认YES More...
 
CGPoint scaleOrigin
 比例尺原点位置 More...
 
CGSize scaleSize
 比例尺的最大宽高 More...
 
CGPoint logoCenter
 logo位置, 必须在mapView.bounds之内,否则会被忽略 More...
 
CGSize logoSize
 logo的宽高 More...
 
double metersPerPointForCurrentZoom
 在当前缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米) More...
 
BOOL isAbroad
 标识当前地图中心位置是否在中国范围外。此属性不是精确判断,不能用于边界区域 More...
 
NSUInteger maxRenderFrame
 最大帧数,有效的帧数为:60、30、20、10等能被60整除的数。默认为60 More...
 
BOOL isAllowDecreaseFrame
 是否允许降帧,默认为YES More...
 
BOOL openGLESDisabled
 停止/开启 OpenGLES绘制, 默认NO. 对应回调是 - (void)mapView:(MAMapView *) didChangeOpenGLESDisabled:(BOOL) More...
 
CGPoint screenAnchor
 地图的视图锚点。坐标系归一化,(0, 0)为MAMapView左上角,(1, 1)为右下角。默认为(0.5, 0.5),即当前地图的视图中心 (since 5.0.0) More...
 
NSRunLoopMode runLoopMode
 地图渲染的runloop mode,默认为NSRunLoopCommonModes。如果是和UIScrollView一起使用且不希望地图在scrollView拖动时渲染,请设置此值为NSDefaultRunLoopMode。(since 5.1.0) More...
 
NSNumber * showsWorldMap
 是否显示海外地图,默认为@NO. 注意:必须先在官网申请开通海外权限 More...
 
NSNumber * mapLanguage
 设置语言。中文:@0: 英文:@1. 英文使用注意事项:1、不能和自定义地图样式同时使用;2、英文状态只在MAMapTypeStandard生效 More...
 
NSArray * annotations
 所有添加的标注, 注意从5.3.0开始返回数组内不再包含定位蓝点userLocation More...
 
NSArray * selectedAnnotations
 处于选中状态的标注数据数据(其count == 0 或 1) More...
 
CGRect annotationVisibleRect
 annotation 可见区域 More...
 
BOOL customMapStyleEnabled
 是否开启自定义样式, 默认NO. since 5.0.0 More...
 
BOOL showsIndoorMap
 是否显示室内地图, 默认NO More...
 
BOOL showsIndoorMapControl
 是否显示室内地图默认控件, 默认YES More...
 
CGSize indoorMapControlSize
 默认室内地图控件的最大宽高 More...
 
NSArray * overlays
 所有添加的Overlay More...
 
BOOL showsUserLocation
 是否显示用户位置 More...
 
MAUserLocationuserLocation
 当前的位置数据 More...
 
BOOL customizeUserLocationAccuracyCircleRepresentation
 是否自定义用户位置精度圈(userLocationAccuracyCircle)对应的 view, 默认为 NO.
如果为YES: 会调用 - (MAOverlayRenderer *)mapView (MAMapView *)mapView rendererForOverlay: (MAMapView(Overlay))overlay 若返回nil, 则不加载.
如果为NO : 会使用默认的样式. More...
 
MACircleuserLocationAccuracyCircle
 用户位置精度圈 对应的overlay More...
 
MAUserTrackingMode userTrackingMode
 定位用户位置的模式, 注意:在follow模式下,设置地图中心点、设置可见区域、滑动手势、选择annotation操作会取消follow模式,并触发 - (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated; More...
 
BOOL userLocationVisible
 当前位置再地图中是否可见 More...
 
CLLocationDistance distanceFilter
 设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动 More...
 
CLLocationAccuracy desiredAccuracy
 设定定位精度。默认为kCLLocationAccuracyBest More...
 
CLLocationDegrees headingFilter
 设定最小更新角度。默认为1度,设定为kCLHeadingFilterNone会提示任何角度改变 More...
 
BOOL pausesLocationUpdatesAutomatically
 指定定位是否会被系统自动暂停 More...
 
BOOL allowsBackgroundLocationUpdates
 是否允许后台定位。默认为NO。只在iOS 9.0之后起作用。
设置为YES的时候必须保证 Background Modes 中的 Location updates处于选中状态,否则会抛出异常。
注意:定位必须在停止的状态下设置(showsUserLocation = NO),否则无效 More...
 

Method Documentation

◆ __attribute [1/2]

- (BOOL skyModelEnable) __attribute ((deprecated("已废弃 since 6.0.0"))) 

是否支持天空模式,默认为YES. 开启后,进入天空模式后,annotation重用可视范围会缩减

Provided by category MAMapView(Annotation).

◆ __attribute [2/2]

- (CGFloat trafficRatio) __attribute ((deprecated("已废弃 since 6.0.0, 不再支持修改实时交通线宽"))) 

设置实时交通线宽系数,默认线宽系数为0.8,范围为0 - 1

◆ addAnimationWith:zoomAnimation:rotateAnimation:cameraDegreeAnimation:

- (void) addAnimationWith: (CAKeyframeAnimation *)  mapCenterAnimation
zoomAnimation: (CAKeyframeAnimation *)  zoomAnimation
rotateAnimation: (CAKeyframeAnimation *)  rotateAnimation
cameraDegreeAnimation: (CAKeyframeAnimation *)  cameraDegreeAnimation 

添加CAKeyframeAnimation动画。(since 6.0.0)

Parameters
mapCenterAnimation地图中心点动画
zoomAnimation放大缩小动画
rotateAnimation旋转动画
cameraDegreeAnimation仰角动画

◆ addAnnotation:

- (void) addAnnotation: (id< MAAnnotation >)  annotation

向地图窗口添加标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View

Parameters
annotation要添加的标注

Provided by category MAMapView(Annotation).

◆ addAnnotations:

- (void) addAnnotations: (NSArray *)  annotations

向地图窗口添加一组标注,需要实现MAMapViewDelegate的-mapView:viewForAnnotation:函数来生成标注对应的View

Parameters
annotations要添加的标注数组

Provided by category MAMapView(Annotation).

◆ addOverlay:

- (void) addOverlay: (id< MAOverlay >)  overlay

向地图窗口添加Overlay。 需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer。 默认添加层级:MAGroundOverlay默认层级为MAOverlayLevelAboveRoads,其余overlay类型默认层级为MAOverlayLevelAboveLabels

Parameters
overlay要添加的overlay

Provided by category MAMapView(Overlay).

◆ addOverlay:level:

- (void) addOverlay: (id< MAOverlay >)  overlay
level: (MAOverlayLevel)  level 

向地图窗口添加Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer

Parameters
overlay要添加的overlay
level添加的overlay所在层级

Provided by category MAMapView(Overlay).

◆ addOverlays:

- (void) addOverlays: (NSArray *)  overlays

向地图窗口添加一组Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer 默认添加层级:MAOverlayLevelAboveLabels

Parameters
overlays要添加的overlay数组

Provided by category MAMapView(Overlay).

◆ addOverlays:level:

- (void) addOverlays: (NSArray *)  overlays
level: (MAOverlayLevel)  level 

向地图窗口添加一组Overlay,需要实现MAMapViewDelegate的-mapView:rendererForOverlay:函数来生成标注对应的Renderer

Parameters
overlays要添加的overlay数组
level添加的overlay所在层级

Provided by category MAMapView(Overlay).

◆ annotationsInMapRect:

- (NSSet *) annotationsInMapRect: (MAMapRect mapRect

获取指定投影矩形范围内的标注

Parameters
mapRect投影矩形范围
Returns
标注集合

Provided by category MAMapView(Annotation).

◆ clearDisk

- (void) clearDisk

清除所有磁盘上缓存的地图数据(不包括离线地图)

◆ clearIndoorMapCache

- (void) clearIndoorMapCache

清空室内地图缓存

Provided by category MAMapView(Indoor).

◆ convertCoordinate:toPointToView:

- (CGPoint) convertCoordinate: (CLLocationCoordinate2D)  coordinate
toPointToView: (UIView *)  view 

将经纬度转换为指定view坐标系的坐标

Parameters
coordinate经纬度
view指定的view
Returns
基于指定view坐标系的坐标

◆ convertPoint:toCoordinateFromView:

- (CLLocationCoordinate2D) convertPoint: (CGPoint)  point
toCoordinateFromView: (UIView *)  view 

将指定view坐标系的坐标转换为经纬度

Parameters
point指定view坐标系的坐标
view指定的view
Returns
经纬度

◆ convertRect:toRegionFromView:

- (MACoordinateRegion) convertRect: (CGRect)  rect
toRegionFromView: (UIView *)  view 

将指定view坐标系的rect转换为经纬度region

Parameters
rect指定view坐标系的rect
view指定的view
Returns
经纬度region

◆ convertRegion:toRectToView:

- (CGRect) convertRegion: (MACoordinateRegion region
toRectToView: (UIView *)  view 

将经纬度region转换为指定view坐标系的rect

Parameters
region经纬度region
view指定的view
Returns
指定view坐标系的rect

◆ dequeueReusableAnnotationViewWithIdentifier:

- (MAAnnotationView *) dequeueReusableAnnotationViewWithIdentifier: (NSString *)  identifier

从复用内存池中获取制定复用标识的annotation view

Parameters
identifier复用标识
Returns
annotation view

Provided by category MAMapView(Annotation).

◆ deselectAnnotation:animated:

- (void) deselectAnnotation: (id< MAAnnotation >)  annotation
animated: (BOOL)  animated 

取消选中标注数据对应的view

Parameters
annotation标注数据
animated是否有动画效果

Provided by category MAMapView(Annotation).

◆ exchangeOverlay:withOverlay:

- (void) exchangeOverlay: (id< MAOverlay >)  overlay1
withOverlay: (id< MAOverlay >)  overlay2 

交换两个overlay

Parameters
overlay1overlay1
overlay2overlay2

Provided by category MAMapView(Overlay).

◆ exchangeOverlayAtIndex:withOverlayAtIndex:

- (void) exchangeOverlayAtIndex: (NSUInteger)  index1
withOverlayAtIndex: (NSUInteger)  index2 

在MAOverlayLevelAboveLabels上交换指定索引处的Overlay

Parameters
index1索引1
index2索引2

Provided by category MAMapView(Overlay).

◆ exchangeOverlayAtIndex:withOverlayAtIndex:atLevel:

- (void) exchangeOverlayAtIndex: (NSUInteger)  index1
withOverlayAtIndex: (NSUInteger)  index2
atLevel: (MAOverlayLevel)  level 

交换指定索引处的Overlay

Parameters
index1索引1
index2索引2
level所处层级

Provided by category MAMapView(Overlay).

◆ forceRefresh

- (void) forceRefresh

强制刷新。(since 6.0.0)

◆ getHittedPolylinesWith:traverseAll:

- (NSArray*) getHittedPolylinesWith: (CLLocationCoordinate2D)  tappedCoord
traverseAll: (BOOL)  traverseAll 

获取点击选中的polylineRenderer, 注意:开启polylineRenderer的点击选中功能,需设置userInteractionEnabled=YES。since 7.1.0

Parameters
tappedCoord点击点的坐标
traverseAll如果有polyline重合情况,是否返回多个。NO: 只返回最上面的 YES:返回所有
Returns
返回选中的polylineRenderer数组,最上面的在第一个

Provided by category MAMapView(Overlay).

◆ getMapStatus

- (MAMapStatus *) getMapStatus

获取地图状态

Returns
地图状态

◆ insertOverlay:aboveOverlay:

- (void) insertOverlay: (id< MAOverlay >)  overlay
aboveOverlay: (id< MAOverlay >)  sibling 

在指定的Overlay之上插入一个overlay

Parameters
overlay带添加的Overlay
sibling用于指定相对位置的Overlay

Provided by category MAMapView(Overlay).

◆ insertOverlay:atIndex:

- (void) insertOverlay: (id< MAOverlay >)  overlay
atIndex: (NSUInteger)  index 

在指定的索引处添加一个Overlay

Parameters
overlay要添加的overlay
index指定的索引

Provided by category MAMapView(Overlay).

◆ insertOverlay:atIndex:level:

- (void) insertOverlay: (id< MAOverlay >)  overlay
atIndex: (NSUInteger)  index
level: (MAOverlayLevel)  level 

在指定层级的指定的索引处添加一个Overlay

Parameters
overlay要添加的overlay
index指定的索引
level指定的层级

注:各个层级的索引分开计数; 若index大于level层级的最大索引,则添加至level层级的最大索引之后。

Provided by category MAMapView(Overlay).

◆ insertOverlay:belowOverlay:

- (void) insertOverlay: (id< MAOverlay >)  overlay
belowOverlay: (id< MAOverlay >)  sibling 

在指定的Overlay之下插入一个overlay

Parameters
overlay带添加的Overlay
sibling用于指定相对位置的Overlay

Provided by category MAMapView(Overlay).

◆ mapContentApprovalNumber

- (NSString *) mapContentApprovalNumber

获取地图审图号。如果启用了“自定义样式”功能(customMapStyleEnabled 为 YES),则返回nil。(since 5.4.0)

Returns
地图审图号

◆ mapRectThatFits:

- (MAMapRect) mapRectThatFits: (MAMapRect mapRect

重新计算可见地图矩形区域,使之匹配mapview长宽比

Parameters
mapRect要调整的地图矩形区域
Returns
调整后的地图矩形区域

◆ mapRectThatFits:edgePadding:

- (MAMapRect) mapRectThatFits: (MAMapRect mapRect
edgePadding: (UIEdgeInsets)  insets 

根据边缘插入来调整地图矩形区域,使之匹配mapview加insets后的长宽比

Parameters
mapRect要调整的地图矩形区域
insets边缘插入
Returns
调整后的地图矩形区域

◆ metersPerPointForZoomLevel:

- (double) metersPerPointForZoomLevel: (CGFloat)  zoomLevel

在指定的缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米).

Parameters
zoomLevel指定的缩放级别, 在[minZoomLevel, maxZoomLevel]范围内.
Returns
对应的距离(单位是米)

◆ overlaysInLevel:

- (NSArray *) overlaysInLevel: (MAOverlayLevel)  level

取位于level下的overlays

Parameters
level层级

Provided by category MAMapView(Overlay).

◆ regionThatFits:

- (MACoordinateRegion) regionThatFits: (MACoordinateRegion region

根据当前地图视图frame的大小调整region范围

Parameters
region要调整的经纬度范围
Returns
调整后的经纬度范围

◆ reloadInternalTexture

- (void) reloadInternalTexture

重新加载内部纹理,在纹理被错误释放时可以执行此方法。(since 5.4.0)

◆ reloadMap

- (void) reloadMap

重新加载地图

将离线地图解压到 Documents/3dvmap/ 目录下后,调用此函数使离线数据生效, 对应的回调分别是 offlineDataWillReload:(MAMapView *)mapView, offlineDataDidReload:(MAMapView *)mapView.

◆ removeAnnotation:

- (void) removeAnnotation: (id< MAAnnotation >)  annotation

移除标注

Parameters
annotation要移除的标注

Provided by category MAMapView(Annotation).

◆ removeAnnotations:

- (void) removeAnnotations: (NSArray *)  annotations

移除一组标注

Parameters
annotations要移除的标注数组

Provided by category MAMapView(Annotation).

◆ removeOverlay:

- (void) removeOverlay: (id< MAOverlay >)  overlay

移除Overlay

Parameters
overlay要移除的overlay

Provided by category MAMapView(Overlay).

◆ removeOverlays:

- (void) removeOverlays: (NSArray *)  overlays

移除一组Overlay

Parameters
overlays要移除的overlay数组

Provided by category MAMapView(Overlay).

◆ rendererForOverlay:

- (MAOverlayRenderer *) rendererForOverlay: (id< MAOverlay >)  overlay

查找指定overlay对应的Renderer,如果该View尚未创建,返回nil

Parameters
overlay指定的overlay
Returns
指定overlay对应的Renderer

Provided by category MAMapView(Overlay).

◆ satelliteImageApprovalNumber

- (NSString *) satelliteImageApprovalNumber

获取卫星图片审图号。(since 5.4.0)

Returns
卫星图片审图号

◆ selectAnnotation:animated:

- (void) selectAnnotation: (id< MAAnnotation >)  annotation
animated: (BOOL)  animated 

选中标注数据对应的view。注意:如果annotation对应的annotationView因不在屏幕范围内而被移入复用池,为了完成选中操作,会将对应的annotationView添加到地图上,并将地图中心点移至annotation.coordinate的位置。

Parameters
annotation标注数据
animated是否有动画效果

Provided by category MAMapView(Annotation).

◆ setCameraDegree:animated:duration:

- (void) setCameraDegree: (CGFloat)  cameraDegree
animated: (BOOL)  animated
duration: (CFTimeInterval)  duration 

设置地图相机角度(范围为[0.f, 60.f],但高于40度的角度需要在16级以上才能生效)

Parameters
cameraDegree要设置的相机角度
animated是否动画
duration动画时间

◆ setCenterCoordinate:animated:

- (void) setCenterCoordinate: (CLLocationCoordinate2D)  coordinate
animated: (BOOL)  animated 

设置当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化

Parameters
coordinate要设置的中心点
animated是否动画设置

◆ setCompassImage:

- (void) setCompassImage: (UIImage *)  image

设置指南针的图片

Parameters
image新的指南针图片

◆ setConstructingRoadEnable:

- (void) setConstructingRoadEnable: (BOOL)  enabled

设置在建道路图层是否显示。默认NO(since 7.7.0)

Parameters
enabled是否显示

◆ setCurrentIndoorMapFloorIndex:

- (void) setCurrentIndoorMapFloorIndex: (NSInteger)  floorIndex

设置当前室内地图楼层数

Parameters
floorIndex要设置的楼层数

Provided by category MAMapView(Indoor).

◆ setCustomMapStyleID:

- (void) setCustomMapStyleID: ((deprecated("已废弃, 请使用 setCustomMapStyleOptions: since 6.6.0")))  __attribute

自定义地图样式id, 官网发布后下次开启自定义样式便可生效,目前仅支持自定义标准类型. 默认不生效,调用customMapStyleEnabled=YES使生效. since 6.0.0

Parameters
customMapStyleID自定义样式ID,从官网获取

Provided by category MAMapView(CustomMapStyle).

◆ setCustomMapStyleOptions:

- (void) setCustomMapStyleOptions: (MAMapCustomStyleOptions *)  styleOptions

自定义地图样式设置,可以支持分级样式配置,如控制不同级别显示不同的颜色(自7.0.0开始样式有更新,旧的样式文件不能继续使用,必须到官网重新导出新样式文件。 自6.6.0开始使用新版样式,旧版样式无法在新版接口setCustomMapStyleOptions:(MAMapCustomStyleOptions *)styleOptions中使用,请到官网(lbs.amap.com)更新新版样式文件.)

Parameters
styleOptions自定义样式options. since 6.6.0

Provided by category MAMapView(CustomMapStyle).

◆ setCustomMapStyleWithWebData:

- (void) setCustomMapStyleWithWebData: ((deprecated("已废弃, 请使用 setCustomMapStyleOptions: since 6.6.0")))  __attribute

根据web导出数据设置地图样式, 目前仅支持自定义标准类型. 默认不生效,调用customMapStyleEnabled=YES使生效. since 5.2.0

Parameters
data高德web端工具导出的地图样式数据.

Provided by category MAMapView(CustomMapStyle).

◆ setCustomTextureResourcePath:

- (void) setCustomTextureResourcePath: ((deprecated("已废弃, 请使用 setCustomMapStyleOptions: since 6.6.0")))  __attribute

设置自定义纹理. since 5.7.0

Parameters
customTextureResourcePath自定义纹理文件路径.

Provided by category MAMapView(CustomMapStyle).

◆ setIndoorMapControlOrigin:

- (void) setIndoorMapControlOrigin: (CGPoint)  origin

设置默认室内地图控件位置

Parameters
origin左上角点位置

Provided by category MAMapView(Indoor).

◆ setMapStatus:animated:

- (void) setMapStatus: (MAMapStatus *)  status
animated: (BOOL)  animated 

设置地图状态

Parameters
status要设置的地图状态
animated是否动画

◆ setMapStatus:animated:duration:

- (void) setMapStatus: (MAMapStatus *)  status
animated: (BOOL)  animated
duration: (CFTimeInterval)  duration 

设置地图状态

Parameters
status要设置的地图状态
animated是否动画
duration动画时间,默认动画时间为0.35s

◆ setRegion:animated:

- (void) setRegion: (MACoordinateRegion region
animated: (BOOL)  animated 

设定当前地图的经纬度范围,该范围可能会被调整为适合地图窗口显示的范围

Parameters
region要设定的经纬度范围
animated是否动画设置

◆ setRotationDegree:animated:duration:

- (void) setRotationDegree: (CGFloat)  rotationDegree
animated: (BOOL)  animated
duration: (CFTimeInterval)  duration 

设置地图旋转角度(逆时针为正向)

Parameters
rotationDegree旋转角度, 如当前角度是0,720表示逆时针旋转2周,-720表示正时针旋转2周
animated动画
duration动画时间

◆ setUserTrackingMode:animated:

- (void) setUserTrackingMode: (MAUserTrackingMode)  mode
animated: (BOOL)  animated 

设置定位用户位置的模式

Parameters
mode要设置的模式
animated是否动画设置

Provided by category MAMapView(UserLocation).

◆ setVisibleMapRect:animated:

- (void) setVisibleMapRect: (MAMapRect mapRect
animated: (BOOL)  animated 

设置可见区域

Parameters
mapRect要设定的可见区域
animated是否动画设置

◆ setVisibleMapRect:edgePadding:animated:

- (void) setVisibleMapRect: (MAMapRect mapRect
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设置可见地图矩形区域

Parameters
insets边缘插入
mapRect要显示的地图矩形区域
animated是否动画效果

◆ setZoomLevel:animated:

- (void) setZoomLevel: (CGFloat)  zoomLevel
animated: (BOOL)  animated 

设置缩放级别(默认3-19,有室内地图时为3-20)

Parameters
zoomLevel要设置的缩放级别
animated是否动画设置

◆ setZoomLevel:atPivot:animated:

- (void) setZoomLevel: (CGFloat)  zoomLevel
atPivot: (CGPoint)  pivot
animated: (BOOL)  animated 

根据指定的枢纽点来缩放地图

Parameters
zoomLevel缩放级别
pivot枢纽点(基于地图view的坐标系)
animated是否动画

◆ showAnnotations:animated:

- (void) showAnnotations: (NSArray *)  annotations
animated: (BOOL)  animated 

设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。

Parameters
annotations需要显示的annotation
animated是否执行动画

Provided by category MAMapView(Annotation).

◆ showAnnotations:edgePadding:animated:

- (void) showAnnotations: (NSArray *)  annotations
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设置地图使其可以显示数组中所有的annotation, 如果数组中只有一个则直接设置地图中心为annotation的位置。

Parameters
annotations需要显示的annotation
insetsinsets 嵌入边界
animated是否执行动画

Provided by category MAMapView(Annotation).

◆ showOverlays:animated:

- (void) showOverlays: (NSArray *)  overlays
animated: (BOOL)  animated 

设置地图使其可以显示数组中所有的overlay, 如果数组中只有一个则直接设置地图中心为overlay的位置。

Parameters
overlays需要显示的overlays
animated是否执行动画

Provided by category MAMapView(Overlay).

◆ showOverlays:edgePadding:animated:

- (void) showOverlays: (NSArray *)  overlays
edgePadding: (UIEdgeInsets)  insets
animated: (BOOL)  animated 

设置地图使其可以显示数组中所有的overlay, 如果数组中只有一个则直接设置地图中心为overlay的位置。

Parameters
overlays需要显示的overlays
insetsinsets 嵌入边界
animated是否执行动画

Provided by category MAMapView(Overlay).

◆ takeSnapshotInRect:

- (UIImage *) takeSnapshotInRect: ((deprecated("已废弃,请使用takeSnapshotInRect:withCompletionBlock:方法 since 6.0.0")))  __attribute

在指定区域内截图(默认会包含该区域内的annotationView),注意不要在地图回调方法内直接调用

Parameters
rect指定的区域
Returns
截图image

◆ takeSnapshotInRect:withCompletionBlock:

- (void) takeSnapshotInRect: (CGRect)  rect
withCompletionBlock: (void(^)(UIImage *resultImage, NSInteger state))  block 

异步在指定区域内截图(默认会包含该区域内的annotationView), 地图载入完整时回调

Parameters
rect指定的区域
block回调block(resultImage:返回的图片,state:0载入不完整,1完整)

◆ updateUserLocationRepresentation:

- (void) updateUserLocationRepresentation: (MAUserLocationRepresentation *)  representation

设定UserLocationView样式。如果用户自定义了userlocation的annotationView,或者该annotationView还未添加到地图上,此方法将不起作用

Parameters
representation样式信息对象

Provided by category MAMapView(UserLocation).

◆ viewForAnnotation:

- (MAAnnotationView *) viewForAnnotation: (id< MAAnnotation >)  annotation

根据标注数据获取标注view

Parameters
annotation标注数据
Returns
对应的标注view

Provided by category MAMapView(Annotation).

Property Documentation

◆ allowsBackgroundLocationUpdates

- (BOOL) allowsBackgroundLocationUpdates
readwritenonatomicassign

是否允许后台定位。默认为NO。只在iOS 9.0之后起作用。
设置为YES的时候必须保证 Background Modes 中的 Location updates处于选中状态,否则会抛出异常。
注意:定位必须在停止的状态下设置(showsUserLocation = NO),否则无效

Provided by category MAMapView(UserLocation).

◆ annotations

- (NSArray*) annotations
readnonatomicassign

所有添加的标注, 注意从5.3.0开始返回数组内不再包含定位蓝点userLocation

Provided by category MAMapView(Annotation).

◆ annotationVisibleRect

- (CGRect) annotationVisibleRect
readnonatomicassign

annotation 可见区域

Provided by category MAMapView(Annotation).

◆ cameraDegree

- (CGFloat) cameraDegree
readwritenonatomicassign

设置地图相机角度(范围为[0.f, 60.f],但高于40度的角度需要在16级以上才能生效)

◆ centerCoordinate

- (CLLocationCoordinate2D) centerCoordinate
readwritenonatomicassign

当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化

◆ compassOrigin

- (CGPoint) compassOrigin
readwritenonatomicassign

指南针原点位置

◆ compassSize

- (CGSize) compassSize
readnonatomicassign

指南针的宽高

◆ customizeUserLocationAccuracyCircleRepresentation

- (BOOL) customizeUserLocationAccuracyCircleRepresentation
readwritenonatomicassign

是否自定义用户位置精度圈(userLocationAccuracyCircle)对应的 view, 默认为 NO.
如果为YES: 会调用 - (MAOverlayRenderer *)mapView (MAMapView *)mapView rendererForOverlay: (MAMapView(Overlay))overlay 若返回nil, 则不加载.
如果为NO : 会使用默认的样式.

Provided by category MAMapView(UserLocation).

◆ customMapStyleEnabled

- (BOOL) customMapStyleEnabled
readwritenonatomicassign

是否开启自定义样式, 默认NO. since 5.0.0

Provided by category MAMapView(CustomMapStyle).

◆ delegate

- (id<MAMapViewDelegate>) delegate
readwritenonatomicweak

地图view的delegate

◆ desiredAccuracy

- (CLLocationAccuracy) desiredAccuracy
readwritenonatomicassign

设定定位精度。默认为kCLLocationAccuracyBest

Provided by category MAMapView(UserLocation).

◆ distanceFilter

- (CLLocationDistance) distanceFilter
readwritenonatomicassign

设定定位的最小更新距离。默认为kCLDistanceFilterNone,会提示任何移动

Provided by category MAMapView(UserLocation).

◆ headingFilter

- (CLLocationDegrees) headingFilter
readwritenonatomicassign

设定最小更新角度。默认为1度,设定为kCLHeadingFilterNone会提示任何角度改变

Provided by category MAMapView(UserLocation).

◆ indoorMapControlSize

- (CGSize) indoorMapControlSize
readnonatomicassign

默认室内地图控件的最大宽高

Provided by category MAMapView(Indoor).

◆ isAbroad

- (BOOL) isAbroad
readnonatomicassign

标识当前地图中心位置是否在中国范围外。此属性不是精确判断,不能用于边界区域

◆ isAllowDecreaseFrame

- (BOOL) isAllowDecreaseFrame
readwritenonatomicassign

是否允许降帧,默认为YES

◆ limitMapRect

- (MAMapRect) limitMapRect
readwritenonatomicassign

设置可见地图区域的矩形边界,如限制地图只显示北京市范围

◆ limitRegion

- (MACoordinateRegion) limitRegion
readwritenonatomicassign

设置可见地图区域的矩形边界,如限制地图只显示北京市范围

◆ logoCenter

- (CGPoint) logoCenter
readwritenonatomicassign

logo位置, 必须在mapView.bounds之内,否则会被忽略

◆ logoSize

- (CGSize) logoSize
readnonatomicassign

logo的宽高

◆ mapLanguage

- (NSNumber*) mapLanguage
readwritenonatomicstrong

设置语言。中文:@0: 英文:@1. 英文使用注意事项:1、不能和自定义地图样式同时使用;2、英文状态只在MAMapTypeStandard生效

◆ mapType

- (MAMapType) mapType
readwritenonatomicassign

地图类型

◆ maxRenderFrame

- (NSUInteger) maxRenderFrame
readwritenonatomicassign

最大帧数,有效的帧数为:60、30、20、10等能被60整除的数。默认为60

◆ maxZoomLevel

- (CGFloat) maxZoomLevel
readwritenonatomicassign

最大缩放级别(有室内地图时最大为20,否则为19)

◆ metersPerPointForCurrentZoom

- (double) metersPerPointForCurrentZoom
readnonatomicassign

在当前缩放级别下, 基于地图中心点, 1 screen point 对应的距离(单位是米)

◆ minZoomLevel

- (CGFloat) minZoomLevel
readwritenonatomicassign

最小缩放级别

◆ openGLESDisabled

- (BOOL) openGLESDisabled
readwritenonatomicassign

停止/开启 OpenGLES绘制, 默认NO. 对应回调是 - (void)mapView:(MAMapView *) didChangeOpenGLESDisabled:(BOOL)

◆ overlays

- (NSArray*) overlays
readnonatomicassign

所有添加的Overlay

Provided by category MAMapView(Overlay).

◆ pausesLocationUpdatesAutomatically

- (BOOL) pausesLocationUpdatesAutomatically
readwritenonatomicassign

指定定位是否会被系统自动暂停

Provided by category MAMapView(UserLocation).

◆ region

- (MACoordinateRegion) region
readwritenonatomicassign

当前地图的经纬度范围,设定的该范围可能会被调整为适合地图窗口显示的范围

◆ rotateCameraEnabled

- (BOOL) rotateCameraEnabled
readwritenonatomicassign

是否支持camera旋转, 默认YES

◆ rotateEnabled

- (BOOL) rotateEnabled
readwritenonatomicassign

是否支持旋转, 默认YES

◆ rotationDegree

- (CGFloat) rotationDegree
readwritenonatomicassign

设置地图旋转角度(逆时针为正向)

◆ runLoopMode

- (NSRunLoopMode) runLoopMode
readwritenonatomiccopy

地图渲染的runloop mode,默认为NSRunLoopCommonModes。如果是和UIScrollView一起使用且不希望地图在scrollView拖动时渲染,请设置此值为NSDefaultRunLoopMode。(since 5.1.0)

◆ scaleOrigin

- (CGPoint) scaleOrigin
readwritenonatomicassign

比例尺原点位置

◆ scaleSize

- (CGSize) scaleSize
readnonatomicassign

比例尺的最大宽高

◆ screenAnchor

- (CGPoint) screenAnchor
readwritenonatomicassign

地图的视图锚点。坐标系归一化,(0, 0)为MAMapView左上角,(1, 1)为右下角。默认为(0.5, 0.5),即当前地图的视图中心 (since 5.0.0)

◆ scrollEnabled

- (BOOL) scrollEnabled
readwritenonatomicassign

是否支持平移, 默认YES

◆ selectedAnnotations

- (NSArray*) selectedAnnotations
readwritenonatomiccopy

处于选中状态的标注数据数据(其count == 0 或 1)

Provided by category MAMapView(Annotation).

◆ showsBuildings

- (BOOL) showsBuildings
readwritenonatomicassign

是否显示楼块,默认为YES

◆ showsCompass

- (BOOL) showsCompass
readwritenonatomicassign

是否显示指南针, 默认YES

◆ showsIndoorMap

- (BOOL) showsIndoorMap
readwritenonatomicassign

是否显示室内地图, 默认NO

Provided by category MAMapView(Indoor).

◆ showsIndoorMapControl

- (BOOL) showsIndoorMapControl
readwritenonatomicassign

是否显示室内地图默认控件, 默认YES

Provided by category MAMapView(Indoor).

◆ showsLabels

- (BOOL) showsLabels
readwritenonatomicassign

是否显示底图标注, 默认为YES

◆ showsScale

- (BOOL) showsScale
readwritenonatomicassign

是否显示比例尺, 默认YES

◆ showsUserLocation

- (BOOL) showsUserLocation
readwritenonatomicassign

是否显示用户位置

Provided by category MAMapView(UserLocation).

◆ showsWorldMap

- (NSNumber*) showsWorldMap
readwritenonatomicassign

是否显示海外地图,默认为@NO. 注意:必须先在官网申请开通海外权限

◆ showTraffic

- (BOOL) showTraffic
readwritenonatomicassign

是否显示交通路况图层, 默认为NO

◆ touchPOIEnabled

- (BOOL) touchPOIEnabled
readwritenonatomicassign

是否支持单击地图获取POI信息(默认为YES), 对应的回调是 -(void)mapView:(MAMapView *) didTouchPois:(NSArray *)

◆ trafficStatus

- (NSDictionary<NSNumber *, UIColor *>*) trafficStatus
readwritenonatomiccopy

设置实时交通颜色,key为 MATrafficStatus

◆ userLocation

- (MAUserLocation*) userLocation
readnonatomicassign

当前的位置数据

Provided by category MAMapView(UserLocation).

◆ userLocationAccuracyCircle

- (MACircle*) userLocationAccuracyCircle
readnonatomicassign

用户位置精度圈 对应的overlay

Provided by category MAMapView(UserLocation).

◆ userLocationVisible

- (BOOL) userLocationVisible
readnonatomicassign

当前位置再地图中是否可见

Provided by category MAMapView(UserLocation).

◆ userTrackingMode

- (MAUserTrackingMode) userTrackingMode
readwritenonatomicassign

定位用户位置的模式, 注意:在follow模式下,设置地图中心点、设置可见区域、滑动手势、选择annotation操作会取消follow模式,并触发 - (void)mapView:(MAMapView *)mapView didChangeUserTrackingMode:(MAUserTrackingMode)mode animated:(BOOL)animated;

Provided by category MAMapView(UserLocation).

◆ visibleMapRect

- (MAMapRect) visibleMapRect
readwritenonatomicassign

可见区域, 设定的该范围可能会被调整为适合地图窗口显示的范围

◆ zoomEnabled

- (BOOL) zoomEnabled
readwritenonatomicassign

是否支持缩放, 默认YES

◆ zoomingInPivotsAroundAnchorPoint

- (BOOL) zoomingInPivotsAroundAnchorPoint
readwritenonatomicassign

是否以screenAnchor点作为锚点进行缩放,默认为YES。如果为NO,则以手势中心点作为锚点

◆ zoomLevel

- (CGFloat) zoomLevel
readwritenonatomicassign

缩放级别(默认3-19,有室内地图时为3-20)


The documentation for this class was generated from the following file:
© 2017 高德信息技术有限公司 版权所有,保留所有权利。