---
title: "init(title:message:delegate:cancelButtonTitle:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uialertview/init(title:message:delegate:cancelbuttontitle:)"
---

# init(title:message:delegate:cancelButtonTitle:)

Convenience method for initializing an alert view.

## Declaration

```swift
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’s no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking doc://com.apple.uikit/documentation/UIKit/UIAlertView/addButton(withTitle:) specifying this title.

## Return Value

Return Value Newly initialized alert view.

## See Also

### Creating alert views

- [init(title:message:delegate:cancelButtonTitle:otherButtonTitles:_:)](uikit/uialertview/init(title:message:delegate:cancelbuttontitle:otherbuttontitles:_:).md)
- [init(frame:)](uikit/uialertview/init(frame:).md)
- [init(coder:)](uikit/uialertview/init(coder:).md)
