Austin Erck Austin Erck - 1 year ago 149
Swift Question

Get Height of Table Contents in Swift

I'm trying to get the height of all of a table's contents so I can update the container it is in. This will allow the container and other views in the scroll view to scroll together.

Answer Source

Swift 2.2

func tableViewHeight() -> CGFloat {

    return tableView.contentSize.height


- (CGFloat)tableViewHeight {
    [tableView layoutIfNeeded];

    return [tableView contentSize].height;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download