---
title: cancelButtonIndex
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uialertview/cancelbuttonindex
---

# cancelButtonIndex

The index number of the cancel button.

## Declaration

```swift
var cancelButtonIndex: Int { get set }
```

## Discussion

Discussion The button indices start at 0. If -1, then the index is not set.

## See Also

### Configuring buttons

- [addButton(withTitle:)](uikit/uialertview/addbutton(withtitle:).md)
- [numberOfButtons](uikit/uialertview/numberofbuttons.md)
- [buttonTitle(at:)](uikit/uialertview/buttontitle(at:).md)
- [textField(at:)](uikit/uialertview/textfield(at:).md)
- [firstOtherButtonIndex](uikit/uialertview/firstotherbuttonindex.md)
