snaillovesmile / bsbdj Goto Github PK
View Code? Open in Web Editor NEW仿百思不得姐 swift4.0 MVVM架构
仿百思不得姐 swift4.0 MVVM架构
感觉有点小卡
我提一点小小的意见(勿喷!!!),仔细看了下你的代码关于缓存行高这一块没有做,在我们上下滑动屏幕的时候,我觉得tableview如果不去计算任何东西的话,只要去内存里面去拿意见计算好了的东西是最好的tableview,这些在我们欢动tableview的时候就不会感觉到明细的卡顿了(为什么呢?因为我们在拖动屏幕的时候不需要去计算任何属性,所以cpu可以资源不会被占用,然后我看到你的这种操作模式的话怎么说呢?就像你在打游戏的时候嗑瓜子,如果你买回来了瓜子先把壳全部去掉,打游戏的时候抓一把瓜子肉直接吃,不要去嗑瓜子了!)同样的道理,如果在网络请求下来就把行高计算好,存到了模型里面,用的时候你就可以直接用就好了
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// 1. 根据indexPath获取视图模型
let vm = listViewModel.statusList[indexPath.row]
// 2.返回计算好的行高
return vm.rowHeight
}
我前段时间学习的一个小的项目,写的不咋地,行高这一块已经处理好了..https://github.com/13670242169/QYPWEIBO.git
.关于表格的性能优化
- 尽量少计算,所有需要的素材提前计算好(在表格中这里还没有做到)
- 控件上不要设置图标圆角半径,所有的图标渲染的属性,都要注意(你的项目已经做到了这点)
- 不要动态创建控件,所有需要的控件,都要提前创建好,在现实的时候,根据数据隐藏、显示
- cell中控件的层次越少越好,数量越少越好
没数据啊
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.