iOS. table嵌套WKWebView 自动布局 刷新闪烁问题
2024-04-10 11:40:30  阅读数 1974

先说下我这遇到的情况,
tableView 刷新时候闪动、或者定位出错

1.1、tablwView预设高度 自动布局
self.tableView.estimatedRowHeight = 200;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedSectionHeaderHeight = 0
self.tableView.estimatedSectionFooterHeight = 0

1.2 定义cell的高度
@property (nonatomic, assign) CGFloat webHeigh;

1.3 webView所在的cell的高度计算


image.png

1.4 cell中webView渲染数据后从新获取高度,并刷新tableView


image.png

1.5 刷新:


image.png

最主要的webView的代理别忘了设置:
_webView.navigationDelegate = self;