Giter Club home page Giter Club logo

bsbdj's People

Contributors

snaillovesmile avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bsbdj's Issues

感觉有点小卡

感觉有点小卡image
我提一点小小的意见(勿喷!!!),仔细看了下你的代码关于缓存行高这一块没有做,在我们上下滑动屏幕的时候,我觉得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中控件的层次越少越好,数量越少越好

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.