UITableView dynamic cell heights only correct after some scrolling

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

    The problem is that the initial cells load before we have a valid row height. The workaround is to force a table reload when the view appears.

    - (void)viewDidAppear:(BOOL)animated
    {
      [super viewDidAppear:animated];
      [self.tableView reloadData];
    }
    

提交回复
热议问题