使用estimatedRowHeight的优缺点

1.优点

1> 可以降低tableView:heightForRowAtIndexPath:方法的调用频率

2> 将【计算cell高度的操作】延迟执行了(相当于cell高度的计算是懒加载的)

2.缺点

1> 滚动条长度不准确、不稳定,甚至有卡顿效果(如果不使用estimatedRowHeight,滚动条的长度就是准确的)

/**

这个方法的特点:

1.默认情况下(没有设置estimatedRowHeight的情况下)

1> 每次刷新表格时,有多少数据,这个方法就一次性调用多少次(比如有100条数据,每次reloadData时,这个方法就会一次性调用100次)

2> 每当有cell进入屏幕范围内,就会调用一次这个方法

2.设置estimatedRowHeight的情况下

1> 用到了(显示了)哪个cell,才会调用这个方法计算那个cell的高度(方法调用频率降低了)

*/

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{

return self.topics[indexPath.row].cellHeight;

}

最新文章

  1. python之递归实现
  2. [Java入门笔记] Java语言简介
  3. 【转】Kafka实战-Flume到Kafka
  4. .net 4.0 自定义本地缓存策略的不同实现
  5. 解决java switch……case不能匹配字符串的问题
  6. 让ubuntu使用root帐号并让winscp以root身份登录
  7. 【从零学习Python】Ubuntu14.10下Python开发环境配置
  8. (诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案(转)
  9. struts2.1.6教程六、使用标签
  10. java关键字中文对比
  11. WPF后台写ControlTemplate总结
  12. Idea(一) 安装与破解
  13. MQ 简单的使用
  14. JavaScript的基本包装类型说明
  15. React Native升级目标SDK
  16. LeetCode【100. 相同的树】
  17. 【Selenium-WebDriver自学】Selenium-IDE验证点(五)
  18. SPSS-回归分析
  19. [转]经验分享:微信小程序外包接单常见问题及流程
  20. MVC登录前准备写好cookie

热门文章

  1. iGPT and ViT
  2. CausalVAE: Disentangled Representation Learning via Neural Structural Causal Models
  3. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks
  4. Generating Adversarial Examples with Adversarial Networks
  5. Deep Residual Learning for Image Recognition (ResNet)
  6. 新手入门typeScript
  7. SpringCloud集成Security安全(Eureka注册中心)
  8. Git_同一个本地仓库上传到不同的远端仓库(github、gitee)
  9. GOF23种设计模式之单例模式(java)
  10. kubeadm 安装Kubernetes 1.16.3 (CentOS7+IPVS+Calico)