<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTableView/deselectRow(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTableView(im)deselectRow:"
  },
  "title" : "deselectRow(_:)"
}
-->

# deselectRow(_:)

Deselects the row at the specified index if it’s selected.

```
func deselectRow(_ row: Int)
```

## Parameters

`row`

The index of the row to deselect.

## Discussion

Deselects the row at `rowIndex` if it’s selected, regardless of whether empty selection is allowed.

If the selection does in fact change, posts [`selectionDidChangeNotification`](/documentation/AppKit/NSTableView/selectionDidChangeNotification) to the default notification center.

If the indicated row was the last row selected by the user, the row nearest it effectively becomes the last selected row. In case of a tie, priority is given to the row above.

This method doesn’t check with the delegate before changing the selection.

## See Also

[`allowsEmptySelection`](/documentation/AppKit/NSTableView/allowsEmptySelection)

A Boolean value indicating whether the table view allows the user to select zero columns or rows.



---

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)