UITableView dynamic cell heights only correct after some scrolling

后端 未结 24 1232
误落风尘
误落风尘 2020-11-29 16:41

I have a UITableView with a custom UITableViewCell defined in a storyboard using auto layout. The cell has several multiline UILabels.

24条回答
  •  粉色の甜心
    2020-11-29 17:03

    Setting preferredMaxLayoutWidth helps in my case. I added

    cell.detailLabel.preferredMaxLayoutWidth = cell.frame.width
    

    in my code.

    Also refer to Single line text takes two lines in UILabel and http://openradar.appspot.com/17799811.

提交回复
热议问题