Class

CPInterfaceController

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

Declaration

@interface CPInterfaceController : NSObject

Overview

An interface controller manages one or more templates in the navigation hierarchy. You don’t create the interface controller. Instead, the system creates it for you, and passes the controller to your app by way of the CPApplicationDelegate method application:didConnectCarInterfaceController:toWindow:. For more information, see Adding CarPlay Support to Your Navigation App.

After receiving the controller, store a reference to it in your app. Then set the root template by calling the setRootTemplate:animated: method. To display another template in the navigation hierarchy, call pushTemplate:animated:, and use popTemplateAnimated: to remove the top-most template.

You also use the interface controller to display a single template modally. Call presentTemplate:animated: to display the modal template, and call dismissTemplateAnimated: to dismiss it.

Topics

Configuring the Interface Controller

- setRootTemplate:animated:

Sets the root template, starting a new stack for the template navigation hierarchy.

delegate

An object serving as the delegate to the interface controller.

CPInterfaceControllerDelegate

The interface that an object implements to serve as a delegate to an interface controller.

Accessing Templates on the Navigation Stack

rootTemplate

The current root template in the template navigation hierarchy.

topTemplate

The top-most template in the navigation hierarchy stack.

templates

The current stack of templates in the navigation hierarchy.

Pushing and Popping Templates

- pushTemplate:animated:

Pushes a template onto the navigation stack and updates the CarPlay display.

- popTemplateAnimated:

Pops the top template from the navigation stack and updates the CarPlay display.

- popToRootTemplateAnimated:

Pops all templates on the stack—except the root template—and updates the CarPlay display.

- popToTemplate:animated:

Pops templates until the specified template is at the top of the navigation stack.

Displaying Templates Modally

- presentTemplate:animated:

Presents a template modally.

- dismissTemplateAnimated:

Dismisses the template that the interface controller is displaying modally.

presentedTemplate

The current modal template displayed by the interface controller.

Relationships

Inherits From

See Also

User Interface Basics

CPMapTemplate

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

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.