Class ISN_UIAlertController
An object that displays an alert message to the user. Use this class to configure alerts and action sheets with the message that you want to display and the actions from which to choose. After configuring the alert controller with the actions and style you want, present it using the Present() method. UIKit displays alerts and action sheets modally over your apps content.
In addition to displaying a message to a user, you can associate actions with your alert controller to give the user a way to respond. For each action you add using the AddAction(ISN_UIAlertAction) method, the alert controller configures a button with the action details. When the user taps that action, the alert controller executes the block you provided when creating the action object.
Inheritance
Inherited Members
Namespace: SA.iOS.UIKit
Assembly: cs.temp.dll.dll
Syntax
public class ISN_UIAlertController
Constructors
ISN_UIAlertController(String, String, ISN_UIAlertControllerStyle)
Declaration
public ISN_UIAlertController(string title, string message, ISN_UIAlertControllerStyle preferredStyle)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | |
System.String | message | |
ISN_UIAlertControllerStyle | preferredStyle |
Properties
Actions
The actions that the user can take in response to the alert or action sheet.
The actions are in the order in which you added them to the alert controller. This order also corresponds to the order in which they are displayed in the alert or action sheet. The second action in the array is displayed below the first, the third is displayed below the second, and so on.
Declaration
public List<ISN_UIAlertAction> Actions { get; set; }
Property Value
Type | Description |
---|---|
List<ISN_UIAlertAction> |
Id
Gets the unique alert identifier.
Declaration
public int Id { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Message
Descriptive text that provides more details about the reason for the alert.
The message string is displayed below the title string and is less prominent. Use this string to provide additional context about the reason for the alert or about the actions that the user might take.
Declaration
public string Message { get; }
Property Value
Type | Description |
---|---|
System.String |
PreferredAction
The preferred action for the user to take from an alert.
The preferred action is relevant for the Alert 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(ISN_UIAlertAction) method is a programmer error. The default value of this property is nil.
Declaration
public ISN_UIAlertAction PreferredAction { get; set; }
Property Value
Type | Description |
---|---|
ISN_UIAlertAction |
PreferredStyle
The style of the alert controller.
Declaration
public ISN_UIAlertControllerStyle PreferredStyle { get; }
Property Value
Type | Description |
---|---|
ISN_UIAlertControllerStyle |
Title
The title of the alert.
The title string is displayed prominently in the alert or action sheet. You should use this string to get the user’s attention and communicate the reason for displaying the alert.
Declaration
public string Title { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
AddAction(ISN_UIAlertAction)
Attaches an action object to the alert or action sheet. If your alert has multiple actions, the order in which you add those actions determines their order in the resulting alert or action sheet.
Declaration
public void AddAction(ISN_UIAlertAction action)
Parameters
Type | Name | Description |
---|---|---|
ISN_UIAlertAction | action | The action object to display as part of the alert. Actions are displayed as buttons in the alert. The action object provides the button text and the action to be performed when that button is tapped. |
Dismiss()
Dismiss view controller.
Declaration
public void Dismiss()
Present()
Presents a view controller as modal window.
Declaration
public void Present()