Customize view elements

The view allows for several customisations, like picking your own driver marker, or hiding UI elements. This guide will cover these basic customisations.

// HTMapView Methods
- (void)showMapView {
    HTMapView * mapView = [[HTMapView alloc] initWithFrame:self.view.frame taskID:@"1" :@"1800" delegate:self];

    mapView.dataSource = self; // For customisations
    mapView.delegate = self;

    [self.view addSubview:mapView];

View element customisations

These customisations are done with HTMapViewDataSource methods, as detailed below.

// HTMapView DataSource Methods

// Toggle driver info element
- (BOOL)mapView:(HTMapView *)mapView shouldShowDriverInfoViewForTaskWithTaskID:(NSString *)taskID {
    return NO;

// Toggle order lookup element
- (BOOL)mapView:(HTMapView *) shouldShowCallToActionButtonForTaskWithTaskID:(NSString *)taskID {
    return YES;

// Customise image for destination marker
- (UIImage *)mapView:(HTMapView *) imageForDestinationMarkerForTaskWithTaskID:(NSString *)taskID {
    return [UIImage imageNamed:@"destination-marker"];

// Customise image for hero marker
- (UIImage *)mapView:(HTMapView *) imageForHeroMarkerForTaskWithTaskID:(NSString *)taskID {
    return [UIImage imageNamed:@"hero-marker"];

//Customize edit destination feature
- (BOOL)mapView:(HTMapView *)mapView canEditDestinationForTaskWithTaskID:(NSString *)taskID {
  return NO;

Map view customisations

Show Start Location

The default behaviour of the map fragment is to set the bounds with the driver's location and the destination. If you want the bounds to include start location as well, call shouldDisableDynamicZoomForMapView: on HTMapViewDataSource. With this, the start location will be visible in the bounds, along with the driver's location and the destination.

- (void)shouldDisableDynamicZoomForMapView:(HTMapView *)mapView {
return NO;

Disabling Map Auto-bounds

To disable auto-bounds, and keep the map bounds stationary when the Driver moves, use the disableMapBounds method on HTMapView.

[mapView disableMapBounds];

Reset Map Bounds

By calling resetMapBounds on HTMapView you can reset the behaviour of map auto-bounds, to change bounds as the Driver's location changes.

If mapViewShouldDisableDynamicZoom is used to show start location, it will also be included in the map bounds.

[mapView resetMapBounds];

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""