---
title: "addButton(withTitle:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiactionsheet/addbutton(withtitle:)"
---

# addButton(withTitle:)

Adds a custom button to the action sheet.

## Declaration

```swift
func addButton(withTitle title: String?) -> Int
```

## Parameters

- `title`: The title of the new button.

## Return Value

Return Value The index of the new button. Button indices start at 0 and increase in the order they are added.

## See Also

### Related Documentation

- [UIActionSheet](uikit/uiactionsheet.md)

### Configuring buttons

- [numberOfButtons](uikit/uiactionsheet/numberofbuttons.md)
- [buttonTitle(at:)](uikit/uiactionsheet/buttontitle(at:).md)
- [cancelButtonIndex](uikit/uiactionsheet/cancelbuttonindex.md)
- [destructiveButtonIndex](uikit/uiactionsheet/destructivebuttonindex.md)
- [firstOtherButtonIndex](uikit/uiactionsheet/firstotherbuttonindex.md)
