---
title: "tableView(_:willDeselectRowAt:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableviewdelegate/tableview(_:willdeselectrowat:)"
---

# tableView(_:willDeselectRowAt:)

Tells the delegate that a specified row is about to be deselected.

## Declaration

```swift
optional func tableView(_ tableView: UITableView, willDeselectRowAt indexPath: IndexPath) -> IndexPath?
```

## Parameters

- `tableView`: A table view informing the delegate about the impending deselection.
- `indexPath`: An index path locating the row in tableView to be deselected.

## Return Value

Return Value An index path that confirms or alters the deselected row. Return an NSIndexPath object other than indexPath if you want another cell to be deselected. Return nil if you don’t want the row deselected.

## Discussion

Discussion This method is only called if there is an existing selection when the user tries to select a different row. The delegate is sent this method for the previously selected row. You can use UITableViewCell.SelectionStyle.none to disable the appearance of the cell highlight on touch-down.

## See Also

### Responding to row selections

- [Handling row selection in a table view](uikit/handling-row-selection-in-a-table-view.md)
- [Selecting multiple items with a two-finger pan gesture](uikit/selecting-multiple-items-with-a-two-finger-pan-gesture.md)
- [tableView(_:willSelectRowAt:)](uikit/uitableviewdelegate/tableview(_:willselectrowat:).md)
- [tableView(_:didSelectRowAt:)](uikit/uitableviewdelegate/tableview(_:didselectrowat:).md)
- [tableView(_:didDeselectRowAt:)](uikit/uitableviewdelegate/tableview(_:diddeselectrowat:).md)
- [tableView(_:shouldBeginMultipleSelectionInteractionAt:)](uikit/uitableviewdelegate/tableview(_:shouldbeginmultipleselectioninteractionat:).md)
- [tableView(_:didBeginMultipleSelectionInteractionAt:)](uikit/uitableviewdelegate/tableview(_:didbeginmultipleselectioninteractionat:).md)
- [tableViewDidEndMultipleSelectionInteraction(_:)](uikit/uitableviewdelegate/tableviewdidendmultipleselectioninteraction(_:).md)
