MRMapView Class Reference

Inherits from UIView
Declared in MRMapView.h

Overview

Provides an embeddable map interface, with support for displaying placemarks and routes as well as navigating between maps.

Creating and Configuring the map view

  mapKey

The key that identifies this view’s map. Setting this property will cause the map view to load a new map.

@property (nonatomic, copy) MREditorKey *mapKey

Declared In

MRMapView.h

  map

The map view’s current map.

@property (nonatomic, readonly) MRMap *map

Declared In

MRMapView.h

– setLoading:

Sets the loading state.

- (void)setLoading:(BOOL)loading

Parameters

loading

If YES, the map view will display a visual indication that content is loading.

Declared In

MRMapView.h

  showsPlacemarks

If YES (the default), the map’s placemarks will be displayed.

@property (nonatomic) BOOL showsPlacemarks

Discussion

Placemarks are displayed as map annotations, and are revealed and hidden as the user zooms in and out of the map.

Declared In

MRMapView.h

  showsTags

If YES, the map’s tags will be displayed. The default is NO.

@property (nonatomic) BOOL showsTags

Discussion

Tags are displayed as map annotations, and are revealed and hidden as the user zooms in and out of the map.

Declared In

MRMapView.h

  showsMapPicker

If YES (the default), the map picker control will be displayed.

@property (nonatomic) BOOL showsMapPicker

Discussion

The map picker control allows users to navigate to other maps.

Declared In

MRMapView.h

  showsDirectionsControl

If YES (the default), the directions control will be displayed when a route is loaded.

@property (nonatomic) BOOL showsDirectionsControl

Discussion

The directions control allows users to see information about a route and traverse its steps.

Declared In

MRMapView.h

  showsMapLabel

If YES (the default), the map label will be displayed.

@property (nonatomic) BOOL showsMapLabel

Discussion

The map label indicates the map name and building name of the currently loaded map.

Declared In

MRMapView.h

  showsOverviewButton

If YES (the default), the overview button will be displayed.

@property (nonatomic) BOOL showsOverviewButton

Discussion

The overview button allows users to navigate to the overview map, if one exists.

Declared In

MRMapView.h

  showsLocationButton

If YES (the default), the location button will be displayed.

@property (nonatomic) BOOL showsLocationButton

Discussion

The location button allows the user to navigate to their current location on the map. If their location is on a different map, the map view will switch to the map that contains the user’s location.

Declared In

MRMapView.h

  showsAccessibilityButton

If YES (the default), the accessibility button will be visible when the map is displaying a route.

@property (nonatomic) BOOL showsAccessibilityButton

Discussion

The accessibility button allows the user to toggle a persistent preference to use either the shortest or the most accessible routes. Toggling the preference will cause the map to reload the currently displayed route.

Declared In

MRMapView.h

  showsBannerMessage

If YES (the default), the banner message will be displayed when required.

@property (nonatomic) BOOL showsBannerMessage

Discussion

The banner message is used to display relevant information in a banner (ex. “Reorient yourself to the directions line”)

Declared In

MRMapView.h

  showsUserLocation

If YES (the default), the map will show the users’s current location when available. This may trigger a request for “when in use” location authorization, which requires certain entries in your app’s Info.plist.

@property (nonatomic) BOOL showsUserLocation

Declared In

MRMapView.h

  showsUserHeading

If YES (the default), the map will show the users’s current heading when available.

@property (nonatomic) BOOL showsUserHeading

Declared In

MRMapView.h

  showsLocationAlerts

If YES (the default), the user will be alerted about location failure or conditions that might preclude accurate readings.

@property (nonatomic) BOOL showsLocationAlerts

Declared In

MRMapView.h

  showsWatermark

If YES (the default), the aruba watermark will appear at the top of the map

@property (nonatomic) BOOL showsWatermark

Declared In

MRMapView.h

  mapPickerHighestFloorOnTop

if YES (the default), it is “elevator style” with the highest numbered floor listed in the top most position of the map picker.

@property (nonatomic, assign) BOOL mapPickerHighestFloorOnTop

Declared In

MRMapView.h

  enableMapPickerSearch

if YES (the default), search option will be available for the map picker always. If NO, search bar will be disabled if the number of buildings are < 10 and number of floors in all buildngs are < 10.

@property (nonatomic, assign) BOOL enableMapPickerSearch

Declared In

MRMapView.h

  directionsInstructionsOnTop

if NO (the default), the distance text (eg: 70 feet) in the direction slide will display on the top in bigger font size. if the routing instruction is empty, always the distance text will display in bigger font size on top.

@property (nonatomic, assign) BOOL directionsInstructionsOnTop

Declared In

MRMapView.h

  autoUpdateMapInDirectionMode

if YES (the default), map will adjust the zoom level and orientation as navigate through the steps in direction mode. If NO, map will remain in the same position in direction mode. User can still adjust the zoom and rotation as they want.

@property (nonatomic, assign) BOOL autoUpdateMapInDirectionMode

Declared In

MRMapView.h

  longPressMap

Block to execute when the map is long pressed not on an annotation pointOnMap is the point on the map, in the maps coordinate system where it was long pressed gestureState is the gestures current state Example use @code mapview.longPressMap = ^(CGPoint pointOnMap, UIGestureRecognizerState gestureState) { NSLog(@“State - %@, Point - %@”, @(gestureState), NSStringFromCGPoint(pointOnMap)); }; @endcode

@property (nonatomic, copy, nullable) void ( ^ ) ( CGPoint pointOnMap , UIGestureRecognizerState gestureState ) longPressMap

Declared In

MRMapView.h

User annotations

  annotations

The map’s annotations.

@property (nonnull, nonatomic, readonly) NSArray<id<MRAnnotation> > *annotations

Declared In

MRMapView.h

  placemarks

Placemark annotations (loaded automatically if showsPlacemark==YES).

@property (nonatomic, readonly, copy) NSArray<id<MRAnnotation> > *placemarks

Declared In

MRMapView.h

  tagPredicate

A predicate for filtering visible tags.

@property (nullable, nonatomic, strong) NSPredicate *tagPredicate

Declared In

MRMapView.h

  tagSubscriptions

Tag Subscription(s) to show on the map. While this property is an array, only a single MRDMapTagSubscription or MRDTagIdentifierSubscription are supported while a collection of MRDTagLabelSubscriptions are supported.

@property (nonnull, nonatomic, strong) NSArray<id<MRDTagSubscription> > *tagSubscriptions

Declared In

MRMapView.h

  userLocation

The annotation representing the user’s location.

@property (nonatomic, readonly, strong) MRUserLocation *userLocation

Declared In

MRMapView.h

  selectedAnnotation

The currently selected annotation.

@property (nullable, nonatomic, readonly) id<MRAnnotation> selectedAnnotation

Declared In

MRMapView.h

  selectedAnnotations

Array of currently selected annotations

@property (nullable, nonatomic, readonly) NSArray<id<MRAnnotation> > *selectedAnnotations

Declared In

MRMapView.h

  shouldClusterHighlightedAnnotations

If YES, annotations that are highlighted and collide will be clustered into a transient container annotation. Defaults to YES.

@property (nonatomic, assign) BOOL shouldClusterHighlightedAnnotations

Declared In

MRMapView.h

  highlightedAnnotations

Array of currently highlighted annotations. These annotations could also potentially be clustered.

@property (nonatomic, strong, readonly) NSArray<MRAnnotation> *highlightedAnnotations

Declared In

MRMapView.h

  visibleAnnotations

The annotations that are visible on the map.

@property (nonatomic, strong, readonly) NSArray<MRAnnotation> *visibleAnnotations

Declared In

MRMapView.h

– addAnnotation:

Adds an annotation to the map.

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

Parameters

annotation

The annotation to add.

Declared In

MRMapView.h

– addAnnotations:

Adds the provided annotations to the map.

- (void)addAnnotations:(NSArray<id<MRAnnotation> > *)annotations

Parameters

annotations

The annotations to add.

Declared In

MRMapView.h

– removeAnnotation:

Removes an annotation from the map.

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

Parameters

annotation

The annotation to remove.

Declared In

MRMapView.h

– removeAnnotations:

Removes the specified annotations from the map.

- (void)removeAnnotations:(NSArray<id<MRAnnotation> > *)annotations

Parameters

annotations

The annotations to remove.

Declared In

MRMapView.h

– selectAnnotation:animated:

Causes the specified annotation to become selected.

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

Parameters

annotation

The annotation to select.

animated

If YES, the selection will be animated.

Declared In

MRMapView.h

– selectAnnotations:animated:

As of 5.8.0, multiple annotations can no longer have a selected state. What’s sent to this method will be highlighted. To display the annotations as a list in the bottom sheet, call MRMapViewController’s showAnnotationsInBottomSheet:

- (void)selectAnnotations:(nullable NSArray<id<MRAnnotation> > *)annotations animated:(BOOL)animated

Parameters

annotations

The annotations to highlight.

animated

If YES, the highlighting will be animated.

Declared In

MRMapView.h

– highlightAnnotations:animated:

Highlight multiple annotations on the map. To display the annotations as a list in the bottom sheet, call MRMapViewController’s showAnnotationsInBottomSheet:

- (void)highlightAnnotations:(nullable NSArray<MRAnnotation> *)annotations animated:(BOOL)animated

Parameters

annotations

The annotations to highlight.

animated

If YES, the highlighting will be animated.

Declared In

MRMapView.h

– deselectAnnotationAnimated:

Deselects the currently selected annotation.

- (void)deselectAnnotationAnimated:(BOOL)animated

Parameters

animated

If YES, the deselection will be animated.

Declared In

MRMapView.h

– deselectAnnotations:animated:

As of 5.8.0, multiple annotations can no longer have a selected state. Calling this method will deselect the selected annotation, if there is one, and unhighlight the passed annotations.

- (void)deselectAnnotations:(nullable NSArray<id<MRAnnotation> > *)annotations animated:(BOOL)animated

Parameters

annotations

array of annotations to deselect or nil to deselect all.

animated

If YES, the deselection will be animated.

Declared In

MRMapView.h

– unhighlightAnnotations:animated:

Calling this method will deselect the selected annotation, if there is one, and unhighlight the passed annotations.

- (void)unhighlightAnnotations:(nullable NSArray<id<MRAnnotation> > *)annotations animated:(BOOL)animated

Parameters

annotations

array of annotations to unhighlight or nil to unhighlight all.

animated

If YES, the unhighlighting will be animated.

Declared In

MRMapView.h

– viewForAnnotation:

Returns the view for the currently displayed annotation; returns nil if the view for the annotation isn’t being displayed.

- (nullable MRAnnotationView *)viewForAnnotation:(id<MRAnnotation>)annotation

Parameters

annotation

The annotation to whose view should be returned.

Declared In

MRMapView.h

– defaultViewForAnnotation:

Creates a new “default” annotation view for the given annotation.

- (MRAnnotationView *)defaultViewForAnnotation:(id<MRAnnotation>)annotation

Parameters

annotation

The annotation to create a view for.

Discussion

Uses the mapping:

MRPlacemark -> MRPlacemarkAnnotationView

The dequeueReusableAnnotationViewWithIdentifier: method will be used internally automatically.

Declared In

MRMapView.h

– dequeueReusableAnnotationViewWithIdentifier:

Returns a reusable annotation view located by its identifier.

- (nullable MRAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier

Parameters

identifier

A string identifying the annotation view to be reused.

Declared In

MRMapView.h

Overlays

– overlays

The map’s overlays.

- (NSArray<MRPathOverlay*> *)overlays

Declared In

MRMapView.h

– addOverlay:

Adds an overlay to the map.

- (void)addOverlay:(MRPathOverlay *)overlay

Parameters

overlay

The overlay to add.

Declared In

MRMapView.h

– addOverlays:

Adds the provided overlays to the map.

- (void)addOverlays:(NSArray<MRPathOverlay*> *)overlays

Parameters

overlays

The overlays to add.

Declared In

MRMapView.h

– insertOverlay:atIndex:

Adds the provided overlay to the map.

- (void)insertOverlay:(MRPathOverlay *)overlay atIndex:(NSInteger)index

Parameters

overlay

The overlay to add.

index

The z-index at which to display the overlay

Declared In

MRMapView.h

– removeOverlay:

Removes an overlay from the map.

- (void)removeOverlay:(MRPathOverlay *)overlay

Parameters

overlay

The overlay to remove.

Declared In

MRMapView.h

– removeOverlays:

Removes the specified overlays from the map.

- (void)removeOverlays:(NSArray<MRPathOverlay*> *)overlays

Parameters

overlays

The overlays to remove.

Declared In

MRMapView.h

– rendererForOverlay:

Returns the renderer for the currently displayed overlay; returns nil if the renderer for the overlay isn’t being displayed.

- (MRPathRenderer *)rendererForOverlay:(MRPathOverlay *)overlay

Parameters

overlay

The overlay to whose renderer should be returned.

Declared In

MRMapView.h

Converting Map Coordinates

– convertMapPoint:toPointToView:

Converts a point from the coordinate space of the map to the coordinate space of the specified view.

- (CGPoint)convertMapPoint:(CGPoint)point toPointToView:(UIView *_Nullable)view

Parameters

point

The point on this map to convert.

view

The view whose coordinate space the point should be converted to.

Declared In

MRMapView.h

– convertPoint:toMapPointFromView:

Converts a point from the coordinate space of the specified view to the coordinate space of this map.

- (CGPoint)convertPoint:(CGPoint)point toMapPointFromView:(UIView *_Nullable)view

Parameters

point

The point on this map to convert.

view

The view whose coordinate space the point should be converted from.

Declared In

MRMapView.h

– rectWithCenter:zoomLevel:

Returns a rectangle centered on the specified point and sized according to the specified zoom level.

- (CGRect)rectWithCenter:(CGPoint)center zoomLevel:(MRZoomLevel)zoom

Parameters

center

The point at which to place the rectangle’s center.

zoom

The zoom level to use when determining the rectangle’s size.

Declared In

MRMapView.h

Changing the Visible Portion of the Map

  visibleMapRect

Describes the visible portion of the map. Changing this property will update the map view immediately.

@property (nonatomic) CGRect visibleMapRect

Declared In

MRMapView.h

– setVisibleMapRect:animated:completion:

Updates the currently visible portion of the map, optionally animating the change.

- (void)setVisibleMapRect:(CGRect)mapRect animated:(BOOL)animated completion:(void ( ^ _Nullable ) ( void ))completion

Parameters

mapRect

The rectangle describing the part of the map that should be visible.

animated

If YES, the change will be animated. Otherwise the change will be instant.

completion

If animating, the block to call when animation completes.

Declared In

MRMapView.h

  rotationAngle

Returns the map’s current angle of rotation, in radians.

@property (nonatomic, readonly) CGFloat rotationAngle

Declared In

MRMapView.h

  zoomScale

Returns the map’s current zoom scale.

@property (nonatomic, readonly) CGFloat zoomScale

Declared In

MRMapView.h

– setRotationAngle:animated:completion:

Updates the currently visible portion of the map, optionally animating the change.

- (void)setRotationAngle:(CGFloat)angle animated:(BOOL)animated completion:(void ( ^ _Nullable ) ( void ))completion

Parameters

angle

The angle, in radians, the map’s angle will become.

animated

If YES, the change will be animated. Otherwise the change will be instant.

completion

If animating, the block to call when animation completes.

Declared In

MRMapView.h

– setVisibleMapRect:rotationAngle:animated:completion:

Updates the currently visible portion of the map, optionally animating the change.

- (void)setVisibleMapRect:(CGRect)visibleRect rotationAngle:(CGFloat)angle animated:(BOOL)animated completion:(void ( ^ _Nullable ) ( void ))completion

Parameters

visibleRect

The rectangle describing the part of the map that should be visible.

angle

The angle, in radians, the map’s angle will become.

animated

If YES, the change will be animated. Otherwise the change will be instant.

completion

If animating, the block to call when animation completes.

Declared In

MRMapView.h

Directions support

  route

The current route being displayed.

@property (nullable, nonatomic, strong) MRRoute *route

Declared In

MRMapView.h

  routeStepIndex

The step index of the current route.

@property (nonatomic, assign) NSUInteger routeStepIndex

Declared In

MRMapView.h

– setRoute:animated:

Sets the current route.

- (void)setRoute:(MRRoute *_Nullable)route animated:(BOOL)animated

Parameters

route

The route to display.

animated

If YES, the transition to this route will be animated.

Declared In

MRMapView.h

– setRouteStepIndex:animated:

Sets the step index for the current route.

- (void)setRouteStepIndex:(NSUInteger)index animated:(BOOL)animated

Parameters

index

The index of the desired step.

animated

If YES, the transition to the new step will be animated.

Declared In

MRMapView.h

– scrollToOverview

Zooms and pans the map so that the whole route for the current map can be seen.

- (void)scrollToOverview

Declared In

MRMapView.h

– setDirectionsControlVisible:

Shows or hides the directions control. Has no effect if showsDirectionsControl is set to NO.

- (void)setDirectionsControlVisible:(BOOL)visible

Parameters

visible

Whether or not the directions control should be displayed.

Declared In

MRMapView.h

  showsRoutePath

If YES (the default), the route path will be displayed.

@property (nonatomic) BOOL showsRoutePath

Declared In

MRMapView.h