滚动时不调用estimatedHeightForRowAt [英] estimatedHeightForRowAt is not called on scroll

查看:31
本文介绍了滚动时不调用estimatedHeightForRowAt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们在滚动UITableView时没有调用UITableViewDelegate协议的estimatedHeightForRowAt方法?

Why method estimatedHeightForRowAt of the UITableViewDelegate protocol is not called when we are scrolling UITableView?

方法 estimatedHeightForRowAt 仅在我们初始化 UITableView 时调用.

Method estimatedHeightForRowAt is called only when we initialize UITableView.

推荐答案

只有在我们初始化 UITableView 时才会调用方法estimatedHeightForRowAt.

Method estimatedHeightForRowAt is called only when we initialize UITableView.

正确.前面的所有行都会调用它,因此我们可以估计表格内容的整个高度.这正是它的用途.

Correct. It is called for all rows up front, so we can estimate the whole height of the table content. That is exactly what it is for.

当您滚动并且新行即将出现时,这些现在是包含真实单元格的真实行,因此现在您必须提供真实高度!

When you scroll and the new rows are about to appear, those are now real rows with real cells in them, so now you must give the real heights!

这篇关于滚动时不调用estimatedHeightForRowAt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆