Comments (4)
可以试试我这个,悬浮情况下性能依然高效😁(主要是cpu占用率)
https://github.com/donggelaile/HDCollectionView
from zlcollectionview.
可以试试我这个,悬浮情况下性能依然高效😁(主要是cpu占用率)
https://github.com/donggelaile/HDCollectionView
已好久没做ios开发了,如有空的话能否帮我贡献下代码
from zlcollectionview.
可以试试我这个,悬浮情况下性能依然高效😁(主要是cpu占用率)
https://github.com/donggelaile/HDCollectionView已好久没做ios开发了,如有空的话能否帮我贡献下代码
你好,应您的请求,我下载并调试了您的代码。
发现两个问题:
1、悬浮时的滑动性能,这个已经有人反馈了。可以将最后一个section的数量返回1000来放大这个问题。
2、悬浮时,滑出去的header在滑回来时会无法正确归位。
对于1,我这边加了判断,并在合适的时机自动进行布局的刷新,而非目前的滑动实时刷新。
对于2,我新增保存了headerAtt的原始frame并在对应时机赋会原值。解决了此bug
经过优化后,悬浮后的cpu使用率由90%+降到了50%以下(6s真机)。稍后会提交一个pr
不过,当数据量更大时,比如20000。滑动时CPU依然在90%以上。因为- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect函数依然需要优化。
优化的方向,作者可以参考IGList,先找到对应的段,然后在对应段中查找对应属性。或者参考我的HDCollectionView的二分查找(使用二分查找时需要注意数组是否有序及是否漏查)。目前直接返回self.attributesArray肯定在大数据量时会卡顿.
另外,作者的这套代码有点年久失修的感觉。
1、preparelayout中的代码太长了,急需拆分。(如果遇到了bug,一般情况下真不好改。。。)
2、另外给出的接口全部是delegate回调,如果真实项目中像VerticalViewController那样设置数据源的话,以后的维护肯定比较困难。(比如需求要求交换第一段和第二段样式的顺序,需要改动的代码一大堆。。。)
所以如果使用的话,建议先做一层baselistmodel包装。具体可以参考https://juejin.im/post/5d50c664f265da03e71ae6a6
from zlcollectionview.
感谢了,已提交
from zlcollectionview.
Related Issues (20)
- 控制台报错误,我搜了一下, 是设置translatesAutoresizingMaskIntoConstraints = false才会出现的
- 在iPad上屏幕旋转后界面约束失效 HOT 3
- 横向collectionView, ColumnLayout布局时候,Item能否横向顺序排列 HOT 1
- ios 15会闪退 HOT 6
- 自定义左右间距,以及cell中间间距,和collectionview的背景色时达不到想要的效果 HOT 1
- iOS15.5崩溃,列表不停地移除数据,请求数据会崩溃 HOT 2
- Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no UICollectionViewLayoutAttributes instance for -layoutAttributesForDecorationViewOfKind: ZLCollectionReusableView at path <NSIndexPath: 0xd75e8385f47ec650> {length = 2, path = 0 - 0}' HOT 1
- 拖动有问题
- 横向collectionView,拖动排序,拖动到边缘无法自动滚动到其他cell(屏幕外),竖向的是可以 HOT 1
- 这种形式的可以实现吗 HOT 7
- 请问下demo运行警告怎么去掉呢 HOT 1
- 更新了1.4.7之后,在瀑布流布局会有cell布局的残影。 HOT 2
- 最新版本ZLCollectionViewBaseFlowLayout里重写了layoutAttributesForItemAtIndexPath HOT 3
- ClosedLayout类型下,宽度偶尔计算不正确,导致item的错位 HOT 1
- 在 swift 使用 ZLCollectionViewVerticalLayout 这个的填充 FillLayout 布局 布局错误 HOT 4
- 列布局 ColumnLayout, 纵向 item 排列问题 HOT 6
- 瀑布流布局有bug,数据源多以及复杂情况下瀑布流最后几个X不对 HOT 9
- 填充式布局,存在严重的性能问题。 HOT 2
- 崩溃 [NSObject allocWithZone:]: attempt to allocate object of class 'ZLCollectionViewLayoutAttributes' failed HOT 1
- cell初始化两次怎么 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zlcollectionview.