Sheet Programming Topics

Types of Alerts

There are two types of alerts, standard and caution. Most alerts should be standard alerts, which display the application icon of the current application, as shown in Figure 1.

Figure 1 A standard alert with an application icon

Use a caution alert only to warn the user when a possible side effect of the current task is the inadvertent destruction of data. A caution alert displays a caution icon badged with application icon, as shown in Figure 2.

Figure 2 A caution alert with the caution icon

How you specify the alert type varies according to programmatic interface:

NSAlert. Send setAlertStyle: to an NSAlert object with an argument of NSWarningAlertStyle or NSInformationalAlertStyle to specify a standard alert. Send the same message with an argument of NSCriticalAlertStyle to specify a caution alert.

Functional API. Use the NSBeginAlertSheet function to display a standard alert and NSBeginCriticalAlertSheet to display a caution alert.

Caution alerts should be used only as specified in the Alerts section of Apple Human Interface Guidelines.