---
title: "tableView(_:heightForRowAt:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableviewdelegate/tableview(_:heightforrowat:)"
---

# tableView(_:heightForRowAt:)

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

## Declaration

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

## Mentioned in

Configuring the cells for your table

## Return Value

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

## Discussion

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 property of UITableView instead. The value returned by this method takes precedence over the value in the 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

### Related Documentation

- [tableView(_:estimatedHeightForRowAt:)](uikit/uitableviewdelegate/tableview(_:estimatedheightforrowat:).md)

### Providing header, footer, and row heights

- [tableView(_:heightForHeaderInSection:)](uikit/uitableviewdelegate/tableview(_:heightforheaderinsection:).md)
- [tableView(_:heightForFooterInSection:)](uikit/uitableviewdelegate/tableview(_:heightforfooterinsection:).md)
- [automaticDimension](uikit/uitableview/automaticdimension.md)
