Dynamic UITableView height

后端 未结 11 1622
無奈伤痛
無奈伤痛 2020-12-29 09:47

I would like to set the UITableView to match the height for all the contents in the table view.

This is my storyboard

The problem with this is the t

11条回答
  •  甜味超标
    2020-12-29 09:59

    Update Swift 4 this code working be good

    self.scrollView.layoutIfNeeded()
    self.view.layoutIfNeeded()
    self.tableViewHeightConstraint.constant = CGFloat(self.tableView.contentSize.height)
    

提交回复
热议问题