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

# tableView(_:heightForRowAt:)

Asks the delegate for the height to use for a row in a specified location.

```
optional func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
```

## Parameters

`tableView`

The table view requesting this information.

`indexPath`

An index path that locates a row in `tableView`.

## Return Value

A nonnegative floating-point value that specifies the height (in points) that `row` should be.

## Discussion

Override this method when the rows of your table are not all the same height. If your rows are the same height, do not override this method; assign a value to the [`rowHeight`](/documentation/UIKit/UITableView/rowHeight) property of [`UITableView`](/documentation/UIKit/UITableView) instead. The value returned by this method takes precedence over the value in the [`rowHeight`](/documentation/UIKit/UITableView/rowHeight) property.

Before it appears onscreen, the table view calls this method for the items in the visible portion of the table. As the user scrolls, the table view calls the method for items only when they move onscreen. It calls the method each time the item appears onscreen, regardless of whether it appeared onscreen previously.

## See Also

[`tableView(_:estimatedHeightForRowAt:)`](/documentation/UIKit/UITableViewDelegate/tableView(_:estimatedHeightForRowAt:))

Asks the delegate for the estimated height of a row in a specified location.



---

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)