czl0325 / ZLCollectionView

为应对类似淘宝首页,京东首页,国美首页等复杂布局而写的Collectionview。基于UICollectionView实现,目前支持标签布局,列布局,百分比布局,定位布局,填充式布局,瀑布流布局等。支持纵向布局和横向布局,可以根据不同的section设置不同的布局,支持拖动cell,头部悬浮,设置section背景色和自定义section背景view,向自定义背景view传递自定义方法。功能强大,超过Android的recyclerview,实现了电影选座等高难度的布局。
MIT License
1.16k stars 166 forks source link

最新版本ZLCollectionViewBaseFlowLayout里重写了layoutAttributesForItemAtIndexPath #63

Closed LiZhimingAlive closed 1 year ago

LiZhimingAlive commented 1 year ago

最新版本ZLCollectionViewBaseFlowLayout里重写了layoutAttributesForItemAtIndexPath,是通过self.attributesArray[indexPath.item]数组下标获取的,而self.attributesArray数组里是包含header和footer的attribute的,导致通过下标获取的不正确,外部调用layoutAttributesForItemAtIndexPath时获取的的UICollectionViewLayoutAttributes不正确

czl0325 commented 1 year ago
 2022-11-18 09:40:50.493250+0800 ZLCollectionView[5817:59382] <ZLCollectionViewLayoutAttributes: 0x7f7dd6436bd0; index path: (0-0); frame = (10 40; 179.577 30)>
 2022-11-18 09:40:54.493031+0800 ZLCollectionView[5817:59382] <ZLCollectionViewLayoutAttributes: 0x7f7dd6644f80; index path: (0-1); frame = (10 80; 184.278 30)>
 2022-11-18 09:40:58.493451+0800 ZLCollectionView[5817:59382] <ZLCollectionViewLayoutAttributes: 0x7f7dd6436d60; index path: (0-2); frame = (10 120; 230.178 30)>
 2022-11-18 09:41:02.493043+0800 ZLCollectionView[5817:59382] <ZLCollectionViewLayoutAttributes: 0x7f7dd4f2d720; index path: (0-3); frame = (10 160; 214.878 30)>

目前我打印获取是正常的,我虽然重写了layoutAttributesForItemAtIndexPath,但是并没有被调用到

tang786472181 commented 1 year ago

hi,大佬,我们的APP升级到1.4.7后,在获取数据源后reloaddata,然后执行mjrefresh的endrefresh,正常流程下是OK的,中间我们还会插入一组数据到瀑布流中,做banner,调用的也是reloadData,在一些极限情况下会导致item的frame会错位;定位问题发现在mjrefresh的endrefresh后立马调用reloaddata,反复的启动杀死APP调用瀑布流的业务接口,就会触发这个问题,降级到1.4.6之后,重复在mjrefresh的endrefresh后立马调用reloaddata再也不会出现该问题,感觉可能跟上面的同学提出来的正相关😂

czl0325 commented 1 year ago

1.4.8已删除