UITableView 性能优化
2016-01-11 17:41
435 查看
网络图片异步加载,SDWebImage。
文字直接 drawInRect/drawAtPoint 绘制,参考 ABTableViewCell,AdvancedTableViewCells。
本地图片也可以直接绘制,或者用 CALayer 来添加显示。
cell 重用机制。
cell 内容尽量避免透明效果。
如非必要,减少 reloadData 全部 cell,只 reloadRowsAtIndexPaths。
如果 cell 是动态行高,计算出高度后缓存。tableView 会在加载的时候把全部 cell 的高度通过
如果 cell content 的展示位置也不固定,第一次计算后也要缓存。
cell 高度固定的话直接用
cell content 的解析操作(尤其是复杂的解析)异步进行+预执行,解析结果要缓存。
可以预先加载需要的网络资源(图片等),SDWebImagePrefetcher.
There are performance implications to using
转载自:http://fann.im/blog/2012/09/11/uitableview-optimization-notes/
文字直接 drawInRect/drawAtPoint 绘制,参考 ABTableViewCell,AdvancedTableViewCells。
本地图片也可以直接绘制,或者用 CALayer 来添加显示。
cell 重用机制。
cell 内容尽量避免透明效果。
如非必要,减少 reloadData 全部 cell,只 reloadRowsAtIndexPaths。
如果 cell 是动态行高,计算出高度后缓存。tableView 会在加载的时候把全部 cell 的高度通过
heightForRowAtIndexPath:都计算出来,即使 cell 还没有展示。
如果 cell content 的展示位置也不固定,第一次计算后也要缓存。
cell 高度固定的话直接用
cell.rowHeight设置高度,不要再实现
tableView:heightForRowAtIndexPath:delegate.
cell content 的解析操作(尤其是复杂的解析)异步进行+预执行,解析结果要缓存。
可以预先加载需要的网络资源(图片等),SDWebImagePrefetcher.
There are performance implications to using
tableView:heightForRowAtIndexPath:instead of the
rowHeightproperty. Every time a table view is displayed, it calls
tableView:heightForRowAtIndexPath:on the delegate for each of its rows, which can result in a significant performance problem with table views having a large number of rows (approximately 1000 or more). via Apple Document
转载自:http://fann.im/blog/2012/09/11/uitableview-optimization-notes/
相关文章推荐
- Looper.myQueue().addIdleHandler,在activty界面显示后做一些事情,就在这个idlehandler中做
- druid 文档 和 源码地址
- UILabel 详解
- AirPrint: 无交互的后台打印实现(Print without UI,iOS8+)
- Fuel安装方法
- iOS UIImage 图片局部拉伸的一些学习要点
- 哈理工OJ HLG OJ 1005Counting Subsequences(map应用)(STL应用)
- 在iOS 9中不在使用UIAlertView使用UIAlertController
- qt-gui的GUI hint参数
- Mirantis OpenStack 7.0: NFVI Deployment Guide — NUMA/CPU pinning
- 用UILabel封装自定义柱状图
- Easyui的combobox组件无法选择内容
- xib正确创建可滑动的UIScrollView
- Android 控件UI自适应解决方案
- HDOJ 1005 Number Sequence规律题
- easyui的datagrid中editor和combogrid的结合使用
- hdu1711 Number Sequence
- 【转载】Java StringBuffer与StringBuider
- 《iOS Human Interface Guidelines》——Notifications
- UI控件监听