Wrong UITableViewCell height with UITableViewAutomaticDimension

前端 未结 4 1682
盖世英雄少女心
盖世英雄少女心 2021-02-09 08:05

I make custom cell with 2 multiline labels and pin this labels to all sides. When in -tableView:heightForRowAtIndexPath: for iOS >= 8 I return

4条回答
  •  抹茶落季
    2021-02-09 08:46

    I solved this issue by setting "text" property of multiline labels to "nil":

    override func prepareForReuse() {
        _label.text = nil
    }
    

    Also table properies "estimatedRowHeight" and "rowHeight" should be set correctly:

    _tableView.estimatedRowHeight = 44
    _tableView.rowHeight = UITableViewAutomaticDimension
    

提交回复
热议问题