---
title: "deselectRow(at:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableview/deselectrow(at:animated:)"
---

# deselectRow(at:animated:)

Deselects a row that an index path identifies, with an option to animate the deselection.

## Declaration

```swift
func deselectRow(at indexPath: IndexPath, animated: Bool)
```

## Parameters

- `indexPath`: An index path identifying a row in the table view.
- `animated`: doc://com.apple.documentation/documentation/Swift/true if you want to animate the deselection, and doc://com.apple.documentation/documentation/Swift/false if the change should be immediate.

## Mentioned in

Handling row selection in a table view

## Discussion

Discussion Calling this method doesn’t cause the delegate to receive a tableView(_:willDeselectRowAt:) or tableView(_:didDeselectRowAt:) message, nor does it send selectionDidChangeNotification notifications to observers. Calling this method doesn’t cause any scrolling to the deselected row.

## See Also

### Selecting rows

- [indexPathForSelectedRow](uikit/uitableview/indexpathforselectedrow.md)
- [indexPathsForSelectedRows](uikit/uitableview/indexpathsforselectedrows.md)
- [selectRow(at:animated:scrollPosition:)](uikit/uitableview/selectrow(at:animated:scrollposition:).md)
- [allowsSelection](uikit/uitableview/allowsselection.md)
- [allowsMultipleSelection](uikit/uitableview/allowsmultipleselection.md)
- [allowsSelectionDuringEditing](uikit/uitableview/allowsselectionduringediting.md)
- [allowsMultipleSelectionDuringEditing](uikit/uitableview/allowsmultipleselectionduringediting.md)
- [selectionFollowsFocus](uikit/uitableview/selectionfollowsfocus.md)
- [selectionDidChangeNotification](uikit/uitableview/selectiondidchangenotification.md)
