Class

CPMapTemplate

A template that provides a navigation bar and map buttons allowing users to interact with your app.

Declaration

@interface CPMapTemplate : CPTemplate

Overview

After the system calls your app delegate’s application:didConnectCarInterfaceController:toWindow: method, create a CPMapTemplate object, and set it as the root template for your interface controller by calling setRootTemplate:animated:.

The map template appears as an overlay on top of the base view. The template is the control layer, providing a navigation bar and map buttons that users interact with through the CarPlay screen.

When the user begins to interact with your app through the CarPlay screen, the system displays the navigation bar, hiding it after a brief period of inactivity. You can change this behavior by setting the automaticallyHidesNavigationBar and hidesButtonsWithNavigationBar properties.

The navigation bar includes up to two leading and two trailing buttons. You can change the buttons, including their title and icon image, by setting the leadingNavigationBarButtons and trailingNavigationBarButtons properties on your template.

Also, you can display additional map buttons by providing an array of CPMapButton objects to mapButtons. Use these buttons to provide users access to actions such as entering panning mode or zooming in and out on the map.

Topics

Configuring Map Templates

automaticallyHidesNavigationBar

A Boolean value that indicates whether the template should automatically hide the navigation bar.

hidesButtonsWithNavigationBar

A Boolean value that tells the system to hide the map buttons when hiding the navigation bar.

guidanceBackgroundColor

The background color the map template uses when displaying guidance.

Handling Map Template Events

mapDelegate

The object that serves as the delegate of the map template.

CPMapTemplateDelegate

The protocol an object implements to handle events from a map template.

Managing Map Buttons

mapButtons

An array of map buttons displayed on the trailing bottom corner of the map template.

CPMapButton

A button representing an action that a map template displays on the CarPlay screen.

Displaying Trip Previews

- showTripPreviews:textConfiguration:

Displays the preview for one or more trips and allows route selection.

- hideTripPreviews

Hides the display of trip previews.

- showRouteChoicesPreviewForTrip:textConfiguration:

Displays the route choices for a single trip.

CPTripPreviewTextConfiguration

A configuration object that lets you change the button titles displayed on a trip preview.

Navigating a Trip

- startNavigationSessionForTrip:

Begins navigational guidance for a trip.

Providing Trip Estimates

- updateTravelEstimates:forTrip:

Updates travel estimates, such as arrival time and remaining time and distance for a trip.

- updateTravelEstimates:forTrip:withTimeRemainingColor:

Updates travel estimates, such as arrival time and remaining time and distance for a trip, with the specified time-remaining color.

CPTimeRemainingColor

The color the system uses when displaying the time remaining for a trip.

tripEstimateStyle

The style that the map template uses when displaying trip estimates during active nagivation.

CPTripEstimateStyle

The set of display styles for trip estimates.

Displaying a Navigation Alert

- presentNavigationAlert:animated:

Displays a navigation alert on the map template.

- dismissNavigationAlertAnimated:completion:

Tells the map template to dismiss the visable navigation alert.

currentNavigationAlert

The visible navigation alert.

CPNavigationAlert

An alert that displays map- or navigation-related information to the user.

Panning the Map

- showPanningInterfaceAnimated:

Shows the panning interface over the map.

- dismissPanningInterfaceAnimated:

Dismisses the panning interface.

panningInterfaceVisible

A Boolean value that indicates whether the map template is displaying the panning interface.

Relationships

Inherits From

See Also

User Interface Basics

CPInterfaceController

A controller that manages the templates that provide the user interface for your app on the CarPlay screen.

CPListTemplate

A template that displays a hierarchical list of items.

CPGridTemplate

A template that displays a grid of items.

CPTemplate

An abstract base class for interface templates.

CPImageSet

Light and dark representations of an image.