使用estimatedRowHeight的优缺点
2024-09-02 23:45:18
使用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;
}
最新文章
- python之递归实现
- [Java入门笔记] Java语言简介
- 【转】Kafka实战-Flume到Kafka
- .net 4.0 自定义本地缓存策略的不同实现
- 解决java switch……case不能匹配字符串的问题
- 让ubuntu使用root帐号并让winscp以root身份登录
- 【从零学习Python】Ubuntu14.10下Python开发环境配置
- (诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案(转)
- struts2.1.6教程六、使用标签
- java关键字中文对比
- WPF后台写ControlTemplate总结
- Idea(一) 安装与破解
- MQ 简单的使用
- JavaScript的基本包装类型说明
- React Native升级目标SDK
- LeetCode【100. 相同的树】
- 【Selenium-WebDriver自学】Selenium-IDE验证点(五)
- SPSS-回归分析
- [转]经验分享:微信小程序外包接单常见问题及流程
- MVC登录前准备写好cookie
热门文章
- iGPT and ViT
- CausalVAE: Disentangled Representation Learning via Neural Structural Causal Models
- Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks
- Generating Adversarial Examples with Adversarial Networks
- Deep Residual Learning for Image Recognition (ResNet)
- 新手入门typeScript
- SpringCloud集成Security安全(Eureka注册中心)
- Git_同一个本地仓库上传到不同的远端仓库(github、gitee)
- GOF23种设计模式之单例模式(java)
- kubeadm 安装Kubernetes 1.16.3 (CentOS7+IPVS+Calico)