A UIAlertController
object displays an alert message to the user. This class replaces the UIActionSheet
and UIAlertView
classes for displaying alerts. After configuring the alert controller with the actions and style you want, present it using the presentViewController:animated:completion:
method. More...
Import Statement
@import UIKit;
Availability
Constants indicating the type of alert to display.
Swift
enum UIAlertControllerStyle : Int { case ActionSheet case Alert}
Objective-C
typedef enum UIAlertControllerStyle: NSInteger { UIAlertControllerStyleActionSheet = 0, UIAlertControllerStyleAlert} UIAlertControllerStyle;
UIAlertControllerStyleActionSheet
An action sheet displayed in the context of the view controller that presented it.
Use an action sheet to present the user with a set of alternatives for how to proceed with a given task. You can also use this style to prompt the user to confirm a potentially dangerous action.
Available in iOS 8.0 and later.
UIAlertControllerStyleAlert
An alert displayed modally for the app.
Available in iOS 8.0 and later.
Available in iOS 8.0 and later.
联系客服