---
title: "alertView(_:didDismissWithButtonIndex:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uialertviewdelegate/alertview(_:diddismisswithbuttonindex:)"
---

# alertView(_:didDismissWithButtonIndex:)

Sent to the delegate after an alert view is dismissed from the screen.

## Declaration

```swift
optional func alertView(_ alertView: UIAlertView, didDismissWithButtonIndex buttonIndex: Int)
```

## Parameters

- `alertView`: The alert view that was dismissed.
- `buttonIndex`: The index of the button that was clicked. The button indices start at 0. If this is the cancel button index, the alert view is canceling. If -1, the cancel button index is not set.

## Discussion

Discussion This method is invoked after the animation ends and the view is hidden.

## See Also

### Customizing behavior

- [alertViewShouldEnableFirstOtherButton(_:)](uikit/uialertviewdelegate/alertviewshouldenablefirstotherbutton(_:).md)
- [willPresent(_:)](uikit/uialertviewdelegate/willpresent(_:).md)
- [didPresent(_:)](uikit/uialertviewdelegate/didpresent(_:).md)
- [alertView(_:willDismissWithButtonIndex:)](uikit/uialertviewdelegate/alertview(_:willdismisswithbuttonindex:).md)
