UITableView content height

前端 未结 4 986
南方客
南方客 2021-01-13 09:02

I have a UITableView that is set to not enable scrolling, and it exists in a UIScrollView. I\'m doing it this way as the design specs call for something that looks like a t

4条回答
  •  走了就别回头了
    2021-01-13 09:32

    Use

    CGRect lastRowRect= [tableView rectForRowAtIndexPath:index_path_for_your_last_row];
    CGFloat contentHeight = lastRowRect.origin.y + lastRowRect.size.height;
    

    You can then use the contentHeight variable to set the contentSize for the scrollView.

提交回复
热议问题