A template that displays a grid of items.


class CPGridTemplate : CPTemplate


Use this template to display a grid of items as buttons. When creating the grid template, provide an array of CPGridButton objects. Each button contains a title, an image, and an optional handler that the system invokes after the user taps the button on the CarPlay screen.

When there are more than eight buttons in the array, the template displays only the first eight. When there are more than four buttons, the template balances the display of the buttons betweem two rows.


Creating a Grid Template

init(title: String?, gridButtons: [CPGridButton])

Creates a grid template with a title and a set of buttons.

class CPGridButton

A menu item button displayed on a grid template.

Getting the Grid Title

var title: String

The title shown in the grid template's navigation bar.

Getting the Grid Buttons

var gridButtons: [CPGridButton]

The array of grid buttons displayed on the template.


Inherits From

See Also

User Interface Basics

class CPInterfaceController

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

class CPMapTemplate

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

class CPListTemplate

A template that displays a hierarchical list of items.

class CPTemplate

An abstract base class for interface templates.

class CPImageSet

Light and dark representations of an image.