<!--
{
  "availability" : [
    "iOS: 2.0.0 - 8.3.0",
    "iPadOS: 2.0.0 - 8.3.0",
    "macCatalyst: 13.1.0 - 13.1.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIActionSheetDelegate/actionSheet(_:willDismissWithButtonIndex:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIActionSheetDelegate(im)actionSheet:willDismissWithButtonIndex:"
  },
  "title" : "actionSheet(_:willDismissWithButtonIndex:)"
}
-->

# actionSheet(_:willDismissWithButtonIndex:)

Sent to the delegate before an action sheet is dismissed.

```
optional func actionSheet(_ actionSheet: UIActionSheet, willDismissWithButtonIndex buttonIndex: Int)
```

## Parameters

`actionSheet`

The action sheet that is about to be dismissed.

`buttonIndex`

The index of the button that was clicked. If this is the cancel button index, the action sheet is canceling. If `-1`, the cancel button index is not set.

## Discussion

This method is invoked before the animation begins and the view is hidden.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)