In apps that run in versions of iOS prior to iOS 8, use the UIAlert
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 UIAction
).
SDKs
- iOS 2.0–9.0Deprecated
- Mac Catalyst 13.0–13.0Deprecated
Framework
- UIKit
Declaration
class UIAlertView : UIView
Overview
UIAlert
is deprecated in iOS 8. (Note that UIAlert
is also deprecated.) To create and manage alerts in iOS 8 and later, instead use UIAlert
with a preferred
of UIAlert
.
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 UIAlert
protocol. Use the show()
method to display an alert view after it is configured.
Subclassing Notes
The UIAlert
class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.