UIAlertView
A view that displays an alert message.
Declaration
@MainActor class UIAlertViewOverview
In apps that run in versions of iOS prior to iOS 8, use the UIAlertView class to display an alert message to the user. An alert view functions similar to but differs in appearance from an action sheet (an instance of UIActionSheet).
Using an alert view
Use the properties and methods defined in this class to set the title, message, and delegate of an alert view and configure the buttons in apps that run in versions of iOS prior to iOS 8. You must set a delegate if you add custom buttons. The delegate should conform to the UIAlertViewDelegate protocol. Use the show() method to display an alert view after it’s configured.
Subclassing notes
The UIAlertView class is intended to be used as-is and doesn’t support subclassing. The view hierarchy for this class is private and must not be modified.
Topics
Creating alert views
init(title:message:delegate:cancelButtonTitle:)init(title:message:delegate:cancelButtonTitle:otherButtonTitles:_:)init(frame:)init(coder:)
Setting properties
Configuring buttons
addButton(withTitle:)numberOfButtonsbuttonTitle(at:)textField(at:)cancelButtonIndexfirstOtherButtonIndex
Displaying
Dismissing
Constants
See Also
Deprecated classes
UIActionSheetUIDocumentMenuViewControllerUILocalNotificationUIMenuControllerUIMenuItemUIMutableUserNotificationActionUIMutableUserNotificationCategoryUIPopoverControllerUIPreviewActionUIPreviewActionGroupUISearchDisplayControllerUIStoryboardPopoverSegueUIWebViewUIUserNotificationActionUIUserNotificationCategory