Using the Navigation SDK for iOS, you can modify the user experience
with your map by determining which of the built-in UI controls and elements
appear on the map, and which gestures you allow. You can also modify the
visual appearance of the Navigation UI. Refer to the
[Policies page](https://developers.google.com/maps/documentation/navigation/ios-sdk/policies.md.txt) for guidelines
on acceptable modifications to the Navigation UI.

## Map UI controls

The Navigation SDK provides some built-in UI controls
similar to those found in the Google Maps for iOS application. You can
toggle the visibility of these controls using the [`GMSUISettings`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt)
class. Changes you make on this class reflect immediately on the map.

> [!NOTE]
> **Note:** Each control has a predetermined position relative to the edge of the map. You can move the controls away from the edges by [padding](https://developers.google.com/maps/documentation/ios-sdk/map.md.txt#map_padding) the map.

### Compass

The Navigation SDK provides a compass graphic that appears
in the top right corner of the map under certain circumstances and only when
enabled. When the user taps the
compass, the camera animates back to a position with a bearing of zero (the
default orientation) and the compass fades away shortly after.

If navigation is enabled and the [camera mode](https://developers.google.com/maps/documentation/navigation/ios-sdk/camera.md.txt)
is set to "following," the compass remains visible and tapping the compass
toggles between tilted and overview camera perspectives.

To avoid driver distraction, the compass remains in the same position if the
header (in portrait mode) expands and conflicts with the default position of the
compass. If you add a secondary header custom control or header accessory view,
the compass is hidden to avoid UI conflicts.

The compass supports day and night modes, as well as dark mode.

The compass is enabled by default in version 11.0.0 and later. You can disable
the compass by setting the
[`compassButton`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#compassbutton)
property of `GMSUISettings` to `false`.

<br />

### Swift

<br />

```swift
mapView.settings.compassButton = false
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.compassButton = NO;
```

<br />

<br />

### My Location button

The My Location button appears in the bottom right corner of the screen *only*
when the My Location button is enabled. When a user clicks the button, the
camera animates to focus on the user's current location if the user's location
is known. You can enable the button by setting the
[`myLocationButton`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#mylocationbutton)
property of `GMSUISettings` to `true`.

<br />

### Swift

<br />

```swift
mapView.settings.myLocationButton = true
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.myLocationButton = YES;
```

<br />

<br />

### Recenter button

When navigation is enabled, the recenter button appears when the user scrolls
the map view, and disappears when the user taps to re-center the map. To allow
the recenter button to appear, set the [`recenterButtonEnabled`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#recenterbuttonenabled)
property of `GMSUISettings` to `true`. To prevent the recenter button from
appearing, set `recenterButtonEnabled` to `false`.

<br />

### Swift

<br />

```swift
mapView.settings.isRecenterButtonEnabled = true
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.recenterButtonEnabled = YES;
```

<br />

<br />

## Map UI accessories

> [!NOTE]
> **Note:** The layout controls in this section, such as `setHeaderAccessoryView(_:)`, are planned for deprecation. To control the layout of the entire navigation screen, use the experimental [layout customization](https://developers.google.com/maps/documentation/navigation/ios-sdk/customize-layout.md.txt) feature.

The Navigation SDK provides UI accessories that appear
during navigation similar to those found in the Google Maps for iOS application.
You can adjust the visibility or visual appearance of these controls as
described in this section. Changes you make here reflect during the user's
next trip.

### Navigation header and footer

![](https://developers.google.com/static/maps/documentation/navigation/ios-sdk/images/navigation_header_footer.png)

During navigation, the navigation header appears at the top of the screen and
the navigation footer appears at the bottom. The navigation header shows the
street name and direction for the next turn on the route, as well as the
direction of the following turn. The navigation footer shows the estimated time
and distance to the destination, as well as the estimated time of arrival.

You can toggle the visibility of the navigation header and footer and set
its colors programmatically using the following properties:

- [`navigationHeaderEnabled`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#navigationheaderenabled) --- controls whether the navigation header is visible (default is `true`).
- [`navigationFooterEnabled`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#navigationfooterenabled) --- controls whether the navigation footer is visible (default is `true`).
- [`navigationHeaderPrimaryBackgroundColor`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#navigationheaderprimarybackgroundcolor) --- sets the primary background color for the navigation header.
- [`navigationHeaderSecondaryBackgroundColor`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#navigationheadersecondarybackgroundcolor) --- sets the secondary background color for the navigation header.

The following code example shows turning on visibility for the header and
footer, then setting `navigationHeaderPrimaryBackgroundColor` to blue, and
`navigationHeaderSecondaryBackgroundColor` to red.

<br />

### Swift

<br />

```swift
mapView.settings.isNavigationHeaderEnabled = true
mapView.settings.isNavigationFooterEnabled = true
mapView.settings.navigationHeaderPrimaryBackgroundColor = .blue
mapView.settings.navigationHeaderSecondaryBackgroundColor = .red
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.navigationHeaderEnabled = YES;
mapView.settings.navigationFooterEnabled = YES;
mapView.settings.navigationHeaderPrimaryBackgroundColor = [UIColor blueColor];
mapView.settings.navigationHeaderSecondaryBackgroundColor = [UIColor redColor];
```

<br />

<br />

### Navigation accessory header view

You can customize your app by replacing the secondary navigation header view
with your own customized accessory view. You do it by creating a view that
implements the `GMSNavigationAccessoryView` protocol. This protocol has one
required method: `-heightForAccessoryViewConstrainedToSize:onMapView:`. You are
given the maximum available size for your view on the given mapView, and you
must provide the height that your view requires.

You can then pass this view to the mapView by calling `setHeaderAccessoryView:`
The mapView animates-out any current views, and then animates-in your custom
view. The navigation header must be visible so that your custom view can
display.

> [!NOTE]
> **Note:** The mapView can be too short in landscape mode on some smartphones, and your custom view will be hidden.

To remove the custom header accessory view, pass `nil` to
`setHeaderAccessoryView:`.

If your view must change size at any time, then you can call
`invalidateLayoutForAccessoryView:`, passing in the view that needs to change
size.

#### Example

The following code example demonstrates a custom view that implements the
`GMSNavigationAccessoryView` protocol. This custom view is then used to set a
custom navigation header accessory view.

<br />

### Swift

<br />

```swift
class MyCustomView: UIView, GMSNavigationAccessoryView {
...
  func heightForAccessoryViewConstrained(to size: CGSize, on mapView: GMSMapView) -> CGFloat {
    // viewHeight gets calculated as the height your view needs.
    return viewHeight
  }
...
}

let customView = MyCustomView(...)
mapView.setHeaderAccessory(customView)

// At some later point customView changes size.
mapView.invalidateLayout(forAccessoryView: customView)

// Remove the custom header accessory view.
mapView.setHeaderAccessory(nil)
```

<br />

### Objective-C

<br />

```objective-c
@interface MyCustomView : UIView <GMSNavigationAccessoryView>
...
@end

@implementation MyCustomView
...
- (CGFloat)heightForAccessoryViewConstrainedToSize:(CGSize)size onMapView:(GMSMapView *)mapView {
  // viewHeight gets calculated as the height your view needs.
  return viewHeight;
}
...
@end

MyCustomView *customView = [[MyCustomView alloc] init...];
[_mapView setHeaderAccessoryView:customView];

// At some later point customView changes size.
[_mapView invalidateLayoutForAccessoryView:customView];

// Remove the custom header accessory view.
[_mapView setHeaderAccessoryView:nil];
```

<br />

<br />

### Low-light mode header colors

Navigation SDK for iOS calculates the suggested lighting mode based on the time of
day and the device's current location, and calls the
[`GMSNavigatorListener.didChangeSuggestedLightingMode`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Protocols/GMSNavigatorListener.md.txt#-navigator:didchangesuggestedlightingmode:)
listener method when the suggested mode changes (such as at sunrise or sunset).
You can programmatically modify low-light mode behavior in the following ways:

- Control when the map uses normal and low-light modes by setting [`GMSMapView.lightingMode`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSMapView.md.txt#lightingmode) to a [`GMSNavigationLightingMode`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Enums/GMSNavigationLightingMode.md.txt) value. For more information about enabling automatic lighting mode switching, see [Configure normal and low-light
  modes](https://developers.google.com/maps/documentation/navigation/ios-sdk/lighting-modes).
- Customize the primary and secondary background colors of the navigation header in low-light mode by setting the [`navigationHeaderPrimaryBackgroundColorNightMode`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#navigationheaderprimarybackgroundcolornightmode) and [`navigationHeaderSecondaryBackgroundColorNightMode`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#navigationheadersecondarybackgroundcolornightmode) properties on [`GMSUISettings`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt).

### Directions List

You can provide step-by-step directions in your app. The following example
shows one possible way to do this. These steps may vary depending on your own
implementation.

1. Enable an entry point button after `setDestinations` on the [`GMSNavigator`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSNavigator.md.txt) (navigator) has completed successfully and `guidanceActive` on the navigator has been enabled.
2. Upon a user tapping on the entry point button, create a `GMSNavigationDirectionsListController` (controller) with the navigator associated with the `GMSMapView` (`mapView`).
3. Add the controller to an instance of `UIViewController` (view controller), and add the `directionsListView` as a subview of the view controller. The `reloadData` and `invalidateLayout` methods on the controller should be called as one would with a `UICollectionView`.
4. Push the view controller onto the app's view controller hierarchy.

> [!NOTE]
> **Notes:**   
>
> - The directions list is not intended to be reused, and should be re-created for each navigation session.
> - The controller holds only a weak reference to the navigator.
> - For a complete sample, refer to the demo app provided in the downloaded package mentioned in the [Set up your project section](https://developers.google.com/maps/documentation/navigation/ios-sdk/setup-overview.md.txt).

The following code example shows adding a `DirectionsListViewController`.

<br />

### Swift

<br />

```swift
override func viewDidLoad() {
  super.viewDidLoad()
  // Add the directionsListView to the host view controller's view.
  let directionsListView = directionsListController.directionsListView
  directionsListView.frame = self.view.frame
  self.view.addSubview(directionsListView)
  directionsListView.translatesAutoresizingMaskIntoConstraints = false
  directionsListView.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true
  directionsListView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor).isActive = true
  directionsListView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor).isActive = true
  directionsListView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
  ...
}

override func viewWillAppear(_ animated: Bool) {
  super.viewWillAppear(animated)
  // Make sure data is fresh when the view appears.
  directionsListController.reloadData()
  ...
}

override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {
  super.willTransition(to: newCollection, with: coordinator)
  // Invalidate the layout during rotation.
  coordinator.animate(alongsideTransition: {_ in
    self.directionsListController.invalidateLayout()
  })
  ...
}
```

<br />

### Objective-C

<br />

```objective-c
- (void)viewDidLoad {
  [super viewDidLoad];
  // Add the directionsListView to the host view controller's view.
  UIView *directionsListView = _directionsListController.directionsListView;
  directionsListView.frame = self.view.bounds;
  [self.view addSubview:directionsListView];
  directionsListView.translatesAutoresizingMaskIntoConstraints = NO;
  [directionsListView.topAnchor constraintEqualToAnchor:self.view.topAnchor].active = YES;
  [directionsListView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = YES;
  [directionsListView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor].active = YES;
  [directionsListView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor].active = YES;
  ...
}

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  // Make sure data is fresh when the view appears.
  [_directionsListController reloadData];
  ...
}

- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection
              withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
  [super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];
  void(^animationBlock)(id <UIViewControllerTransitionCoordinatorContext>context) =
      ^void(id <UIViewControllerTransitionCoordinatorContext>context) {
    [_directionsListController invalidateLayout];
  };
  // Invalidate the layout during rotation.
  [coordinator animateAlongsideTransition:animationBlock
                               completion:nil];
  ...
}

...
```

<br />

<br />

### Trip progress bar

<br />

> [!WARNING]
> [Experimental](https://developers.google.com/maps/launch-stages.md.txt) feature

<br />

![The trip progress bar added to navigation.](https://developers.google.com/static/maps/documentation/navigation/ios-sdk/images/trip_progress_bar.png)

The trip progress bar is a vertical bar that appears on the start/leading side
of the map when navigation starts. When enabled, it displays an overview for an
entire trip, along with the user's destination and current
position.

This lets users anticipate any upcoming issues, such as traffic, without
needing to zoom in. They can then reroute the trip if necessary. If the user
reroutes the trip, the progress bar resets as if a new trip has started from
that point.

The trip progress bar displays the following status indicators:

- **Traffic status**---the status of upcoming traffic.

- **Current location**---the driver's current location in the trip.

- **Route elapsed**---the elapsed portion of the trip.

Enable the trip progress bar by setting the [`navigationTripProgressBarEnabled`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#navigationtripprogressbarenabled)
property in [`GMSUISettings`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt).

<br />

### Swift

<br />

```swift
mapView.settings.isNavigationTripProgressBarEnabled = true
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.navigationTripProgressBarEnabled = YES;
```

<br />

<br />

### Trip progress bar positioning

- The left side of the bar roughly aligns with the left of the speedometer, Google logo, and Re-center button (when visible). The width is 12 pt.
- The trip progress bar responds dynamically to the vertical space on the screen. The bottom of the bar is positioned 210 pt from the bottom of the screen. The top of the trip progress bar remains at least 170 pt from the top of the screen, and the bar's maximum height is 400 pt.
- If the trip progress bar overlaps with the navigation header or other Navigation UI elements, it appears under those other elements.

### Prompt Visibility API (Experimental)

<br />

> [!WARNING]
> [Experimental](https://developers.google.com/maps/launch-stages.md.txt) feature

<br />

The Prompt Visibility API lets you avoid conflicts between UI elements
generated by the Navigation SDK and your own custom UI elements by adding a
listener to receive a callback before a Navigation SDK UI element is about to
appear and as soon as the element is removed. For more information, including
code samples, see the [Prompt Visibility
API](https://developers.google.com/maps/documentation/navigation/ios-sdk/real-time-disruptions#prompt-visibility-api)
section of the *Configure real-time-disruptions* page.

### Speedometer control

When navigation is enabled and the travel mode is set to driving, the Navigation SDK
for iOS displays a speed limit control in the lower corner of the map that shows
the current speed limit. When the driver exceeds the speed limit, the control
expands to display a second speedometer with the driver's current speed.

You can set alert levels to change the formatting of the speedometer display
when the driver exceeds the speed limit by a specified amount. For example,
you can specify that the current speed displays with a red text color when the
driver exceeds the speed limit by 5 mph, and with a red background color
when the driver exceeds the speed limit by 10 mph.

To display the speed limit control, set the [`shouldDisplaySpeedometer`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#shoulddisplayspeedometer)
property of `GMSUISettings` to `true`. To disable the display of the speed limit
control, set `shouldDisplaySpeedometer` to `false`.

<br />

### Swift

<br />

```swift
mapView.settings.shouldDisplaySpeedometer = true
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.shouldDisplaySpeedometer = YES;
```

<br />

<br />

For more information on setting alerts for the speedometer, see
[Configure speedometer alerts](https://developers.google.com/maps/documentation/navigation/ios-sdk/speed_alerts).

### Destination markers

You can show or hide the destination markers for a given route by setting the
[`showsDestinationMarkers`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#showsdestinationmarkers)
property of `GMSUISettings`. The following example shows turning off the
destination markers.

<br />

### Swift

<br />

```swift
mapView.settings.showsDestinationMarkers = false
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.showsDestinationMarkers = NO;
```

<br />

<br />

> [!NOTE]
> **Note:** You can specify a custom image as the marker, but the SDK doesn't support labeling these images with text. For more information, see [Markers](https://developers.google.com/maps/documentation/ios-sdk/marker.md.txt).

## Map experience features

The Navigation SDK lets you make further customizations to the
navigation experience for your users. Changes you
make to your instance reflect during the user's next update of your app.

### Destination highlighting and entrances

![Destination highlighting and entrances](https://developers.google.com/static/maps/documentation/navigation/ios-sdk/images/destination-highlighting-and-entrances.png "Destination highlighting and entrances")

When a destination is created with a [`placeID`](https://developers.google.com/maps/documentation/places/ios-sdk/place-id.md.txt), the destination building will be highlighted and an entrance icon will be shown whenever possible. These visual cues aid users in distinguishing and navigating to their intended destination.

To create a destination with a `placeID`, use one of the [`GMSNavigationWaypoint`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSNavigationWaypoint.md.txt) initializers that accepts a `placeID`. For example, the destinations created in the [Navigate a route tutorial](https://developers.google.com/maps/documentation/navigation/ios-sdk/route.md.txt#create_a_route_and_start_guidance) include destination highlighting and entrance labels when available.

> [!NOTE]
> **Note:** The Navigation SDK doesn't support indoor navigation. For indoor maps without navigation, use the [`indoorEnabled`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMapView.md.txt#indoorenabled) and [`indoorDisplay`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMapView.md.txt#indoordisplay) methods of the [Maps SDK for iOS](https://developers.google.com/maps/documentation/ios-sdk) `GMSMapView` class.

### 3D building display during navigation

![3D building display during navigation](https://developers.google.com/static/maps/documentation/navigation/ios-sdk/images/3d-building-display.png "3D building display during navigation")

3D buildings are displayed during navigation by default. To disable this feature, set [buildingsEnabled](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMapView.md.txt#buildingsenabled) to `false` (Swift) or `NO` (Objective-C).

### Disable default map gestures

You can disable the default gestures on the map by setting properties of the
`GMSUISettings` class, which is available as a property of the `GMSMapView`.
The following gestures can be enabled and disabled programmatically. Note that
disabling the gesture won't limit programmatic access to the camera
settings.

- [`scrollGestures`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#scrollgestures) --- controls whether scroll gestures are enabled or disabled. If enabled, users may swipe to pan the camera.
- [`zoomGestures`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#zoomgestures) --- controls whether zoom gestures are enabled or disabled. If enabled, users may double tap, two-finger tap, or pinch to zoom the camera. Note that double tapping or pinching when `scrollGestures` are enabled may pan the camera to the specified point.
- [`tiltGestures`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#tiltgestures) --- controls whether tilt gestures are enabled or disabled. If enabled, users may use a two-finger vertical down or up swipe to tilt the camera.
- [`rotateGestures`](https://developers.google.com/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSUISettings.md.txt#rotategestures) --- controls whether rotate gestures are enabled or disabled. If enabled, users may use a two-finger rotate gesture to rotate the camera.

In this example, both pan and zoom gestures have been disabled.

<br />

### Swift

<br />

```swift
mapView.settings.scrollGestures = false
mapView.settings.zoomGestures = false
```

<br />

### Objective-C

<br />

```objective-c
mapView.settings.scrollGestures = NO;
mapView.settings.zoomGestures = NO;
```

<br />

<br />

### Position controls and UI elements

> [!NOTE]
> **Note:** The layout guides in this section are planned for deprecation. To control the layout of the entire navigation screen, use the experimental [layout customization](https://developers.google.com/maps/documentation/navigation/ios-sdk/customize-layout.md.txt) feature.

You can position controls and other UI elements relative to the position of the
navigation header and footer, by using the following properties:

- `navigationHeaderLayoutGuide`
- `navigationFooterLayoutGuide`
- `bottomTrailingButtonsLayoutGuide`

> [!NOTE]
> **Note:** To make sure that custom UI elements don't block any prompts that appear in the Navigation SDK, make sure that custom UI elements are implemented in a subview of the `mapView`, not in the root view.

The following code example shows using the layout guides to position a pair of
labels in the map view:

<br />

### Swift

<br />

```swift
/* Add a label to the top left, positioned below the header. */
let topLabel = UILabel()
topLabel.text = "Top Left"
mapView.addSubview(topLabel)
topLabel.translatesAutoresizingMaskIntoConstraints = false
topLabel.topAnchor.constraint(equalTo: mapView.navigationHeaderLayoutGuide.bottomAnchor).isActive = true
topLabel.leadingAnchor.constraint(equalTo: mapView.leadingAnchor).isActive = true

/* Add a label to the bottom right, positioned above the footer. */
let bottomLabel = UILabel()
bottomLabel.text = "Bottom Right"
mapView.addSubview(bottomLabel)
bottomLabel.translatesAutoresizingMaskIntoConstraints = false
bottomLabel.bottomAnchor.constraint(equalTo: mapView.navigationFooterLayoutGuide.topAnchor).isActive = true
bottomLabel.trailingAnchor.constraint(equalTo: mapView.trailingAnchor).isActive = true
```

<br />

### Objective-C

<br />

```objective-c
/* Add a label to the top left, positioned below the header. */
UILabel *topLabel = [[UILabel alloc] init];
topLabel.text = @"Top Left";
[view addSubview:topLabel];
topLabel.translatesAutoresizingMaskIntoConstraints = NO;
[topLabel.topAnchor
    constraintEqualToAnchor:mapView.navigationHeaderLayoutGuide.bottomAnchor].active = YES;
[topLabel.leadingAnchor constraintEqualToAnchor:mapView.leadingAnchor].active = YES;

/* Add a label to the bottom right, positioned above the footer. */
UILabel *bottomLabel = [[UILabel alloc] init];
bottomLabel.text = @"Bottom Right";
[view addSubview:bottomLabel];
bottomLabel.translatesAutoresizingMaskIntoConstraints = NO;
[bottomLabel.bottomAnchor
    constraintEqualToAnchor:mapView.navigationFooterLayoutGuide.topAnchor].active = YES;
[bottomLabel.trailingAnchor constraintEqualToAnchor:mapView.trailingAnchor].active = YES;
```

<br />

<br />

For an example of how to use a `bottomTrailingButtonsLayoutGuide`, to position the
real-time disruptions reporting button, see [Configure real-time disruptions](https://developers.google.com/maps/documentation/navigation/ios-sdk/real-time-disruptions.md.txt#reporting-button-positioning).

### Hide alternate routes

When the user interface becomes cluttered with too much information, you can
reduce clutter by displaying fewer alternate routes than the default (two), or
by displaying no alternate routes at all. You can configure this option before
you fetch the routes by configuring `GMSNavigationRoutingOptions`, and setting
the `alternateRoutesStrategy` with one of the following enumeration values:

| Enumeration Value | Description |
|---|---|
| GMSNavigationAlternateRoutesStrategyAll | Default. Displays up to two alternate routes. |
| GMSNavigationAlternateRoutesStrategyOne | Displays one alternate route (if one is available). |
| GMSNavigationAlternateRoutesStrategyNone | Hides alternate routes. |

#### Example

The following code example demonstrates how to hide alternate routes altogether.

<br />

### Swift

<br />

```swift
let routingOptions = GMSNavigationRoutingOptions(alternateRoutesStrategy: .none)
navigator?.setDestinations(destinations,
                           routingOptions: routingOptions) { routeStatus in
  ...
}

```

<br />

### Objective-C

<br />

```objective-c
GMSNavigationRoutingOptions *routingOptions = [[GMSNavigationRoutingOptions alloc] initWithAlternateRoutesStrategy:GMSNavigationAlternateRoutesStrategyNone];
[navigator setDestinations:destinations
            routingOptions:routingOptions
                  callback:^(GMSRouteStatus routeStatus){...}];
```

<br />

<br />

> [!WARNING]
> **Warning:** This feature is incompatible with the shortest route routing preference. Using both features at the same time can produce unexpected behavior.