forkingdog / UITableView-FDTemplateLayoutCell

Template auto layout cell for automatically UITableViewCell height calculating
MIT License
9.94k stars 2.01k forks source link

如何根据自适应cell的高度累加并得出tableView的高度 #225

Closed roger-int closed 7 years ago

roger-int commented 8 years ago
    for commentPost in self.dataArray {

        let cellHeight = tableView.fd_heightForCellWithIdentifier(commentCellID, configuration: { (cell) in
            (cell as! CommentCell).setvalueWithModel(commentPost as! XJZPost)
        })
        tableViewheight += cellHeight
    }

    self.tableView.snp_updateConstraints { (make) in

        make.height.equalTo(tableViewheight)
    }
    self.tableView.reloadData()

我这样写是不能得到正确的tableView的高度的,而且会报错:Probably at least one of the constraints in the following list is one you don't want. 请问,像我这种情况应该怎样得到tableView的高度呢,困惑不已,望指点迷津

weekwood commented 7 years ago

You should ask this kind of issues on Stack Overflow