Instance Property


The preferred action for the user to take from an alert.


@property(nonatomic, strong) UIAlertAction *preferredAction;


The preferred action is relevant for the UIAlertControllerStyleAlert style only; it is not used by action sheets. When you specify a preferred action, the alert controller highlights the text of that action to give it emphasis. (If the alert also contains a cancel button, the preferred action receives the highlighting instead of the cancel button.) If the iOS device is connected to a physical keyboard, pressing the Return key triggers the preferred action.

The action object you assign to this property must have already been added to the alert controller’s list of actions. Assigning an object to this property before adding it with the addAction: method is a programmer error.

The default value of this property is nil.

See Also

Configuring the User Actions

- addAction:

Attaches an action object to the alert or action sheet.


The actions that the user can take in response to the alert or action sheet.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software