Initializer

init(title:message:delegate:cancelButtonTitle:)

Convenience method for initializing an alert view.

Declaration

convenience init(title: String?, message: String?, delegate: Any?, cancelButtonTitle: String?)

Parameters

title

The string that appears in the receiver’s title bar.

message

Descriptive text that provides more details than the title.

delegate

The receiver’s delegate or nil if it doesn’t have a delegate.

cancelButtonTitle

The title of the cancel button or nil if there is no cancel button.

Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButton(withTitle:) specifying this title.

otherButtonTitles,

The title of another button.

Using this argument is equivalent to invoking addButton(withTitle:) with this title to add more buttons.

Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see Temporary Views.

...

Titles of additional buttons to add to the receiver, terminated with nil.

Return Value

Newly initialized alert view.