How to embed a UITableView in a UIScrollview

后端 未结 6 655
借酒劲吻你
借酒劲吻你 2020-12-05 05:47

How can I do the following in a UIViewController (containing a tableview as a subview)

I initially have a UIViewController showing a preview section (UIView)

6条回答
  •  孤街浪徒
    2020-12-05 05:55

    Or you can just do these steps: 1. Disable scrolling of the tableView. 2. Set height constraint to the tableView and a IBOutlet connected to it. 3. Before you reload the data, calculate the table height. heightConstraint.constant = (heightOfTheSingleTableViewCell) * numOfRows

提交回复
热议问题