- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
通常当我想设置行高时再设置
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
}
更新:
如果我按照自己的意愿提供 estimatedHeightForRowAt,是否会影响 tableview 滚动? .例如我给出 estimatedHeightForRowAt 500
最佳答案
如 iOS documentation 中所述:
If the table contains variable height rows, it might be expensive to calculate all their heights and so lead to a longer load time. Using estimation allows you to defer some of the cost of geometry calculation from load time to scrolling time.
关于ios - heightForRowAt 与 estimatedHeightForRowAt 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45267576/
为什么UITableViewDelegate协议(protocol)的方法estimatedHeightForRowAt在滚动UITableView时没有被调用? 方法 estimatedHeight
我正在制作一个类似聊天的应用程序,其中 tableView 显示动态高度单元格。 单元格以正确的方式限制了它们的 View 和 subview So that the AutoLayout can p
通常当我想设置行高时再设置 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFl
我在一个 ViewController 中有 2 个 tableview。两个表格 View 的单元格高度不同。 在第一个表格 View 中,我通过 heightForRowAt 委托(delegat
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
我是一名优秀的程序员,十分优秀!