UITableView dynamic cell heights only correct after some scrolling

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

    In my case, the issue with the cell height takes place after the initial table view is loaded, and a user action takes place (tapping on a button in a cell that has an effect of changing the cell height). I have been unable to get the cell to change its height unless I do:

    [self.tableView reloadData];
    

    I did try

    [cell layoutIfNeeded];
    

    but that didn't work.

提交回复
热议问题