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

# tableView(_:heightOfRow:)

Asks the delegate for the height of the specified row.

```
@MainActor optional func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat
```

## Parameters

`tableView`

The table view that sent the message.

`row`

The row index.

## Return Value

The height of the row. The height doesn’t include intercell spacing and must be greater than zero.

## Discussion

Implement this method if your table supports varying row heights.

Although table views may cache the returned values, you should ensure that this method is efficient. When you change a row’s height you must invalidate the existing row height by calling [`noteHeightOfRows(withIndexesChanged:)`](/documentation/AppKit/NSTableView/noteHeightOfRows(withIndexesChanged:)).  [`NSTableView`](/documentation/AppKit/NSTableView) automatically invalidates its entire row height cache in response to calls to [`reloadData()`](/documentation/AppKit/NSTableView/reloadData()) or [`noteNumberOfRowsChanged()`](/documentation/AppKit/NSTableView/noteNumberOfRowsChanged()).

If you call [`view(atColumn:row:makeIfNecessary:)`](/documentation/AppKit/NSTableView/view(atColumn:row:makeIfNecessary:)) or [`rowView(atRow:makeIfNecessary:)`](/documentation/AppKit/NSTableView/rowView(atRow:makeIfNecessary:)) within your implementation of this method, the table view throws an exception.

> Important:
> To avoid the possibility of a hang due to unexpected recursion, don’t call geometry-calculating methods such as ``doc://com.apple.appkit/documentation/AppKit/NSView/bounds``,  ``doc://com.apple.appkit/documentation/AppKit/NSTableView/rect(ofColumn:)``, or any ``doc://com.apple.appkit/documentation/AppKit/NSTableView`` method that calls ``doc://com.apple.appkit/documentation/AppKit/NSTableView/tile()`` within your implementation of this method, such as ``doc://com.apple.appkit/documentation/AppKit/NSTableView/intercellSpacing``. To confirm your code isn’t inadvertently causing any calls to ``doc://com.apple.appkit/documentation/AppKit/NSTableView/tile()``, set a breakpoint on ``doc://com.apple.appkit/documentation/AppKit/NSTableView/tile()`` in Xcode.

---

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)