UITableView dynamic cell heights only correct after some scrolling

后端 未结 24 1299
误落风尘
误落风尘 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:14

    For iOS 12+ only, 2019 onwards...

    An ongoing example of Apple's occasional bizarre incompetence, where problems go on for literally years.

    It does seem to be the case that

            cell.layoutIfNeeded()
            return cell
    

    will fix it. (You're losing some performance of course.)

    Such is life with Apple.

提交回复
热议问题