UILabel in UITableViewCell with auto layout has wrong height

前端 未结 6 975
孤独总比滥情好
孤独总比滥情好 2021-02-01 19:00

I have a UITableView with cells that have a fixed height of 100 points. The cells are created in a xib file that uses 3 constraints to pin a UILabel to

6条回答
  •  -上瘾入骨i
    2021-02-01 19:36

    I usually add these two lines to viewDidLoad()

        self.tableView.rowHeight = UITableViewAutomaticDimension
        self.tableView.estimatedRowHeight = 96
    

    This will automatically resize the cell

提交回复
热议问题