tableView(_:heightForRowAt:)
Asks the delegate for the height to use for a row in a specified location.
Declaration
optional func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloatParameters
- tableView:
The table view requesting this information.
- indexPath:
An index path that locates a row in
tableView.
Mentioned in
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 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.