通常当我想设置行高时然后设置
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 300
}
受益者是什么estimatedHeightForRowAt
我什么时候应该使用它。
更新!如果我想设置estimatedHeightForRowAt:
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return // what should i put here
}
UPDATE:
如果我按照我的意愿提供estimatedHeightForRowAt,是否有任何效果表视图滚动? 。例如我给出estimatedHeightForRowAt 500
如指定iOS 文档:
如果表包含可变高度行,则计算所有高度的成本可能会很高,因此会导致更长的加载时间。使用估计可以将几何计算的一些成本从加载时间推迟到滚动时间。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)