MRDirections Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | MRDirections.h |
Overview
Provides access to turn-by-turn directions between points on Meridian maps, calculated on Meridian servers.
– initWithRequest:presentingViewController:
The designated initializer.
- (instancetype)initWithRequest:(MRDirectionsRequest *)request presentingViewController:(UIViewController *_Nullable)viewControllerParameters
request |
The request that describes the desired route. |
|---|---|
viewController |
An optional view controller on which to present a modal “select starting location” interface if needed. Also used to show a loading spinner in the presentingViewController if passed. |
Discussion
The request will be copied during initialization, so any changes made to the request
after this method returns do not affect the request used in calculateDirectionsWithCompletionHandler:.
MRDirections will attempt to retrieve the user’s current location if either request.source or request.destination
have isCurrentLocation set to YES. If you want the user to be automatically prompted to select a starting location
in the case that a current location is not available, you should pass a view that should host the modal interface for choosing
the starting location.
Declared In
MRDirections.h
– calculateDirectionsWithCompletionHandler:
Starts asynchonously calculating a route.
- (void)calculateDirectionsWithCompletionHandler:(MRDirectionsHandler)completionHandlerParameters
completionHandler |
A block to run when the directions request is complete. |
|---|
Discussion
Any calls to calculateDirectionsWithCompletionHandler: while [MRDirections isCalculating] returns YES will fail.
completionHandler will be called on the main queue.
Declared In
MRDirections.h
calculating
Indicates whether or not a request is currently in progress.
@property (nonatomic, readonly, getter=isCalculating) BOOL calculatingDeclared In
MRDirections.h
showsLoadingHUD
Defaults to YES. NO prevents the “Loading Directions” message from appearing.
@property (nonatomic, assign) BOOL showsLoadingHUDDeclared In
MRDirections.h