Route display
Route display
You can display a route on the map and customize its origin and destination icons.
Sample use case: when you add the route, you would like to highlight the starting and the destination points. Also you would like to plan several routes simultaneously with different origin and destination points and use different icons.
Prerequisites:
TTMapView *mapView
object was created and configured. Route coordinates are prepared.
You should also add your start and end route icons to assets, you can call it as you want, e.g. “Start” end “End”.
Icons are added to the route when TTMapRoute
object is created, using imageStart
and imageEnd
fabric methods.
"Start" and "End" here are names of icons from assets. And then pass mapRoute
object to addRoute
method of mapView.routeManager
object, e.g.:
TTMapRoute *mapRoute = [TTMapRoute routeWithCoordinatesData:fullRoute imageStart:[UIImage imageNamed:@"ic_map_route_departure"] imageEnd:[UIImage imageNamed:@"ic_map_route_destination"]];
mapRoute.extraData = fullRoute.summary;
[self.mapView.routeManager addRoute:mapRoute];
If you don’t call imageStart
and imageEnd
methods there will be no icons on the route.
You can specify only start icon by calling only imageStart
or only end icon by calling only
imageEnd
. You can use different images from assets for different routes.