Dynamic height TableView in a Scroll View

前端 未结 1 1580
旧时难觅i
旧时难觅i 2020-12-28 16:38

I am designing a page having a scroll view and above it a table view(scroll disabled). For doing this I have referred answers in this question - Make UITableView not scrolla

相关标签:
1条回答
  • 2020-12-28 17:32

    Just I needed to do this -

    • remove the line - tableView.frame.size = tableView.contentSize

    • Add a height constraint for table view.

    • Set priority to High

    • Create an outlet of the height constraint(Ctrl+Drag).

    • Wherever you need to reload data of your table, set the height constraint to tableview's content height.

    tableHeightConstraint.constant = tableview.contentSize.height
    
    0 讨论(0)
提交回复
热议问题