UITableView 性能优化笔记
2013-10-30 21:47
429 查看
UITableView 性能优化笔记
Hacking Week 技术总结最后一篇,记一下 UITableView 性能优化需要注意和改进的地方。网络图片异步加载,SDWebImage。
文字直接 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
相关文章推荐
- 【android开发】10款实用的Android UI工具,非常有用!
- UITableView性能优化
- 使用iOS手势UIGestureRecognizer
- needtrue需要真实的答案
- Ubiquitous Religions 并查集
- UITableViewCell的选中时的颜色设置
- Android UI系列-----RelativeLayout的相关属性
- DLL 调用错误 -The value of ESP was not properly saved across a function cal
- 【PAT】1062. Talent and Virtue (25)
- Ucos+Ucgui+SDIO+FATS文件系统
- ucos+ucgui(2)
- ucos+ucgui
- ucgui 消息机制之三张图
- UITableView中的visibleCells的用法(visibleCells帮上大忙了)
- 04-EasyUI_登陆的实现
- 训练赛131030 - form lanshui_Yang
- UIEdgeInsetsMake
- ZOJ 3562 Alice's Sequence I 中国剩余定理 不互质
- (顺序表应用5.1.2)UVA 113 The Dole Queue(双向约瑟夫环问题:给出总人数n,顺时针数k个,逆时针数m个)
- ie6或ie8下,UEditor中出错document.body为空或不是对象解决办法