Guides and Sample Code


App Programming Guide for watchOS

Alerts and Action Sheets

Alerts and Action Sheets

Alerts offer a standard way to alert the user to uncommon situations in your app such as error conditions. Action sheets offer a standard interface for prompting the user to select from a specific set of options. Both types of interface represent an interruption in your workflow and should be used only when necessary.

To present an alert or action sheet, call the presentAlertControllerWithTitle:message:preferredStyle:actions: method from the current interface controller. When presenting the interface, you can specify a title and message that you want to display to the user, together with information for one or more buttons. The system uses that information to build the interface. Figure 15-1 shows each of the three interface styles you can create.

Figure 15-1Alert and action sheet styles image: ../Art/alert_styles_2x.png

For information about how to configure and present alerts and action sheets, see WKInterfaceController Class Reference.