<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITableViewDelegate/tableView(_:willDeselectRowAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITableViewDelegate(im)tableView:willDeselectRowAtIndexPath:"
  },
  "title" : "tableView(_:willDeselectRowAt:)"
}
-->

# tableView(_:willDeselectRowAt:)

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

```
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

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

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`](/documentation/UIKit/UITableViewCell/SelectionStyle-swift.enum/none) to disable the appearance of the cell highlight on touch-down.

---

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)