MRMapViewDelegate Protocol Reference

Conforms to NSObject
Declared in MRMapView.h

Overview

Delegate methods for MRMapView.

– mapPickerDidPickMap: required method

Inform our MRMapViewDelegate that the Map Picker selected a new map

- (void)mapPickerDidPickMap:(nonnull MRMap *)map

Parameters

map

MRMap

Declared In

MRMapView.h

– viewControllerToAddSheetToForMapView:

Called when we are not using legacy annotations and are going to add the bottom sheet for the selected annotation. Also called when our map picker is selected

- (nonnull UIViewController *)viewControllerToAddSheetToForMapView:(MRMapView *)mapView

Parameters

mapView

MRMapView where the annotation was selected thus causing the bottom sheet to be added

Return Value

UIViewController the sheet should be added to

Discussion

Note: To Customize the View Controller that is presented use the - (nullable MRDBottomSheetAbstractController *)viewControllerForMapView:(MRMapView *)mapView selectedAnnotationView:(MRAnnotationView *)view delegate method

Declared In

MRMapView.h

– mapViewWillStartLoadingMap:

Called when the map view is about to load a map.

- (void)mapViewWillStartLoadingMap:(MRMapView *)mapView

Parameters

mapView

The map view that will start loading.

Declared In

MRMapView.h

– mapViewDidFinishLoadingMap:

Called when the map view finishes loading a map.

- (void)mapViewDidFinishLoadingMap:(MRMapView *)mapView

Parameters

mapView

The map view that finished loading a map.

Declared In

MRMapView.h

– mapViewDidFailLoadingMap:withError:

Called when the map view fails to load a map.

- (void)mapViewDidFailLoadingMap:(MRMapView *)mapView withError:(NSError *_Nullable)error

Parameters

mapView

The map view that failed to load a map.

error

The error that was generated by the failure.

Declared In

MRMapView.h

– mapViewDidChangeUseAccessiblePaths:

Called when the “Use accessible paths” preference was changed.

- (void)mapViewDidChangeUseAccessiblePaths:(MRMapView *)mapView

Parameters

mapView

The map view that’s reporting the change.

Declared In

MRMapView.h

– mapView:routeDidChange:

Called when the map view’s route changes. Routes may be recalculated to account for location changes.

- (void)mapView:(MRMapView *)mapView routeDidChange:(MRRoute *)route

Parameters

mapView

The map view whose route changed.

route

The new route.

Declared In

MRMapView.h

– mapView:willScrollToStepAtIndex:

Called when the map view is about scroll to a new step index.

- (void)mapView:(MRMapView *)mapView willScrollToStepAtIndex:(NSUInteger)index

Parameters

mapView

The map view that’s about to scroll.

index

The index of the step that will be scrolled to.

Declared In

MRMapView.h

– mapView:willScrollToRect:forRouteStep:

Called when the map view is about change its visible rectangle for a route step. You can return a different rectangle if you want to override the default behavior.

- (CGRect)mapView:(MRMapView *)mapView willScrollToRect:(CGRect)rect forRouteStep:(MRRouteStep *)step

Parameters

mapView

The map view who’s visible rectangle will change.

rect

The rectangle representing the portion of the map that will be visible.

step

The route step associated with this map animation.

Declared In

MRMapView.h

– mapView:visibleMapRectDidChange:

Called whenever the map view changes either programatically (e.g. setVisibleMapRect:) or through user interaction. Processing performed within this callback should be limited to maintain smooth scrolling.

- (void)mapView:(MRMapView *)mapView visibleMapRectDidChange:(BOOL)animated

Parameters

mapView

The map view that has finished scrolling.

animated

If YES, the scroll was animated.

Declared In

MRMapView.h

– mapView:viewForAnnotation:

Provides a view for each annotation. This method may be called for all or some of the added annotations.

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

Parameters

mapView

The map view that’s requesting a view.

annotation

The annotation that the returned view will represent.

Discussion

For Meridian provided annotations (eg. MRLocationController, MRPlacemarkAnnotationView) return nil to use the Meridian-provided annotation view. You may also create the Meridian-provided annotation view yourself by calling -[MRMapView defaultViewForAnnotation:].

Declared In

MRMapView.h

– mapView:didAddAnnotationViews:

Called when one or more annotation views were added to the map.

- (void)mapView:(MRMapView *)mapView didAddAnnotationViews:(NSArray<MRAnnotationView*> *)views

Parameters

mapView

The map view that added the annotation views.

views

An array of MRAnnotationView objects representing the views that were added.

Discussion

If you want to manipulate visible annotation views, you can use this method to know when the views have been added to the map.

Declared In

MRMapView.h

– mapView:rendererForOverlay:

Provides a overlay renderer for each annotation. This method may be called for all or some of the added overlays.

- (nullable MRPathRenderer *)mapView:(MRMapView *)mapView rendererForOverlay:(MRPathOverlay *)overlay

Parameters

mapView

The map view that’s requesting a view.

overlay

The overlay that the returned renderer will display.

Discussion

For Meridian provided annotations (eg. MRLocationController, MRPlacemarkAnnotationView) return nil to use the Meridian-provided annotation view. You may also create the Meridian-provided annotation view yourself by calling -[MRMapView defaultViewForAnnotation:].

Declared In

MRMapView.h

– mapView:didAddOverlayRenderers:

Called when one or more overlay renderes were added to the map.

- (void)mapView:(MRMapView *)mapView didAddOverlayRenderers:(NSArray<MRPathRenderer*> *)renderers

Parameters

mapView

The map view that added the annotation views.

renderers

An array of MRPathRenderer objects representing the renderers that were added.

Discussion

If you want to manipulate visible overlay renderers, you can use this method to know when the renderers have been added to the map.

Declared In

MRMapView.h

– mapView:didLoadPlacemarks:

Called when a map view finishes loading its placemarks.

- (void)mapView:(MRMapView *)mapView didLoadPlacemarks:(NSArray<MRPlacemark*> *)placemarks

Parameters

mapView

The map view that loaded the placemarks.

placemarks

An array of MRPlacemark objects that were loaded for this map.

Discussion

This method is called as soon as the placemarks are loaded but before they have been used to annotate the map. If you need to change any properties of the placemarks that will affect their visibility on the map, such as minimumZoomLevel or hideOnMap, this method is a good place to do that.

Declared In

MRMapView.h

– mapView:didLoadTags:

Called when tags have loaded.

- (void)mapView:(MRMapView *)mapView didLoadTags:(NSArray<MRTag*> *)tags

Parameters

mapView

The map view that loaded the tags.

tags

An array of MRTag objects that were loaded for this map.

Declared In

MRMapView.h

– mapView:didUpdateTag:

Called when a tag has been updated.

- (void)mapView:(MRMapView *)mapView didUpdateTag:(MRTag *)tag

Parameters

mapView

the map view that received the update

tag

The tag that was updated.

Discussion

Note: on maps with lots of tags this will be called very frequently

Declared In

MRMapView.h

– mapView:tagUpdatesStoppedWithError:

Called when all tag updates have stopped because of an error *

- (void)mapView:(MRMapView *)mapView tagUpdatesStoppedWithError:(NSError *)error

Parameters

mapView

the map view that received the update

error

error that resulted in the updates stopping.

Declared In

MRMapView.h

– mapView:willSelectAnnotationView:

Called just before an annotation view becomes selected. You can return a different MRAnnotationView to select or nil if you don’t want the annotation view selected.

- (nullable MRAnnotationView *)mapView:(MRMapView *)mapView willSelectAnnotationView:(MRAnnotationView *)view

Parameters

mapView

The map view that’s reporting the event.

view

The annotation view that’s about to be selected.

Declared In

MRMapView.h

– mapView:didSelectAnnotationView:

Called when an annotation view becomes selected.

- (void)mapView:(MRMapView *)mapView didSelectAnnotationView:(MRAnnotationView *)view

Parameters

mapView

The map view that’s reporting the event.

view

The annotation view that was selected.

Declared In

MRMapView.h

– mapView:didSelectAnnotationViews:

Called when annotation views becomes selected.

- (void)mapView:(MRMapView *)mapView didSelectAnnotationViews:(NSArray<MRAnnotationView*> *)views

Parameters

mapView

The map view that’s reporting the event.

views

The collection of annotation views that are selected.

Declared In

MRMapView.h

– mapView:didDeselectAnnotationView:

Called when an annotation view is deselected.

- (void)mapView:(MRMapView *)mapView didDeselectAnnotationView:(MRAnnotationView *)view

Parameters

mapView

The map view that’s reporting the event.

view

The annotation view that was deselected.

Declared In

MRMapView.h

– mapView:didDeselectAnnotationViews:

Called when annotation views are deselected.

- (void)mapView:(MRMapView *)mapView didDeselectAnnotationViews:(NSArray<MRAnnotationView*> *)views

Parameters

mapView

The map view that’s reporting the event.

views

The annotation views that are deselected.

Declared In

MRMapView.h

– mapView:didHighlightAnnotations:

Called after annotations are marked as highlighted. Use MRMapView’s viewForAnnotation: to get the current view for the highlighted annotation. Depending on the map’s zoom level, annotations can frequently switch between their normal selected/highlighted annotation view and an MRDClusteredAnnotationView. If you are subclassing MRMapViewController your implementation should call super.

- (void)mapView:(MRMapView *)mapView didHighlightAnnotations:(NSArray<MRAnnotation> *)annotations

Parameters

mapView

The mapView that’s reporting the event.

annotations

The highlighted annotations.

Declared In

MRMapView.h

– mapView:didUnhighlightAnnotations:

Called after highlighted annotations are unhighlighted.

- (void)mapView:(MRMapView *)mapView didUnhighlightAnnotations:(NSArray<MRAnnotation> *)annotations

Parameters

mapView

The mapView that’s reporting the event.

annotations

The unhighlighted annotation views.

Declared In

MRMapView.h

– mapView:willTapOverlay:

Called just before an MRPathOverlay tap gets processed. Return nil if the MRPathOverlay should not be processed.

- (MRPathOverlay *)mapView:(MRMapView *)mapView willTapOverlay:(MRPathOverlay *)overlay

Parameters

mapView

The map view that’s reporting the event.

overlay

The MRPathOverlay that’s about to be processed.

Declared In

MRMapView.h

– mapView:didTapOverlay:

Process the MRPathOverlay tap

- (void)mapView:(MRMapView *)mapView didTapOverlay:(MRPathOverlay *)overlay

Parameters

mapView

The map view that’s reporting the event.

overlay

The MRPathOverlay to be processed.

Declared In

MRMapView.h

– viewControllerForMapView:selectedAnnotationView:

Custom View Controller to add to the bottom slide up sheet for a given annotation view

- (nullable MRDBottomSheetAbstractController *)viewControllerForMapView:(MRMapView *)mapView selectedAnnotationView:(MRAnnotationView *)view

Parameters

mapView

MRMapView containing the annotation view

view

MRAnnotationView that was selected

Return Value

MRDBottomSheetAbstractController to be displayed via MRDBottomSheetViewController+addSheetController:toController

Declared In

MRMapView.h

– mapView:locationProviderDidChangeFrom:toProviderType:

Called when our User Location provider changes provider types

- (void)mapView:(nonnull MRMapView *)mapView locationProviderDidChangeFrom:(MRLocationProviderType)previousProviderType toProviderType:(MRLocationProviderType)newProviderType

Parameters

mapView

MRMapView generating the call

previousProviderType

previous provider type of the User’s Location

newProviderType

new provider for the User’s location

Declared In

MRMapView.h

– mapView:didRequestMapPickerForMapKey:

Called when someone would like the map picker to be displayed for a specific map key.

- (void)mapView:(MRMapView *)mapView didRequestMapPickerForMapKey:(MREditorKey *)key

Parameters

mapView

The view that requested the picker.

key

The Map Editor Key used to select the map(s).

Declared In

MRMapView.h

– mapView:didLoadFriends:

Called when friends have loaded.

- (void)mapView:(MRMapView *)mapView didLoadFriends:(NSArray<MRFriend*> *)friends

Parameters

mapView

The map view that loaded the friends.

friends

An array of MRFriend objects that were loaded for this map.

Declared In

MRMapView.h

– mapPickerDetailStringForMap:

Optional Detail string to add to the maps name on the left of the map list

- (nullable NSString *)mapPickerDetailStringForMap:(nonnull MRMap *)map

Parameters

map

MRMap to get the detail string for

Return Value

optional String detail title

Declared In

MRMapView.h

– shouldRespondToUserLocationButton

Notify our delegate that the user location button was tapped

- (BOOL)shouldRespondToUserLocationButton

Return Value

YES if we should continual handling the tap. NO if we should stop the handling of the event.

Declared In

MRMapView.h

– mapView:requestedDirectionsToPlacemark:

Inform our MRMapViewDelegate that directions were requested to a given placemark

- (void)mapView:(nonnull MRMapView *)mapView requestedDirectionsToPlacemark:(nonnull MRPlacemark *)placemark

Parameters

mapView

MRMapView generating the request

placemark

MRPlacemark directions were requested for

Discussion

Note: This method will not be called if a subclass of MRMapViewController is used.

Declared In

MRMapView.h

– mapViewTapped:

The map was tapped, without any sort of overlay or placemark selection being triggered.

- (void)mapViewTapped:(nonnull MRMapView *)mapView

Parameters

mapView

MRMapView that was tapped

Discussion

Note: MRMapViewController’s default implementation uses this to deselect any selected annotations.

Declared In

MRMapView.h