前言
写项目容易遇到的小问题,更新数据源reloadData之后,setContentOffset这个方法有时会不起作用。
解决方法
一行代码即可
[tableView layoutIfNeeded];
iOS 11以上需要额外的以下设置
tableview.estimatedRowHeight = 0;
tableview.estimatedSectionFooterHeight = 0;
tableview.estimatedSectionHeaderHeight = 0;
写项目容易遇到的小问题,更新数据源reloadData之后,setContentOffset这个方法有时会不起作用。
一行代码即可
[tableView layoutIfNeeded];
iOS 11以上需要额外的以下设置
tableview.estimatedRowHeight = 0;
tableview.estimatedSectionFooterHeight = 0;
tableview.estimatedSectionHeaderHeight = 0;