TABAnimated icon indicating copy to clipboard operation
TABAnimated copied to clipboard

第三方瀑布流CHTCollectionViewDelegateWaterfallLayout

Open fanyuexiang opened this issue 3 years ago • 5 comments

使用了CHTCollectionViewDelegateWaterfallLayout实现瀑布流,结果crash,因为((UICollectionView *)target).dataSource = self.protocolContainer;这里protocolContainer没有遵守CHTCollectionViewDelegateWaterfallLayout协议,这种情况该怎么兼容

fanyuexiang avatar Oct 18 '21 06:10 fanyuexiang

设置waterFallLayoutHeightSel

tigerAndBull avatar Oct 18 '21 07:10 tigerAndBull

设置了,还是会停到CHTCollectionViewDelegateWaterfallLayout的断言里。 这里UICollectionView的layout是CHTCollectionViewDelegateWaterfallLayout,它需要遵守CHTCollectionViewDelegateWaterfallLayout协议。而在TABCollectionAnimated里面通过rebindDelegate把collectionView的delegate转为protocolContainer,这个protocolContainer无法遵守CHTCollectionViewDelegateWaterfallLayout协议 QQ20211018-163623@2x

fanyuexiang avatar Oct 18 '21 08:10 fanyuexiang

这里规定参数顺序必须一致。瀑布流的方案大体上都是一致的,你可以改下接口参数的顺序

tigerAndBull avatar Oct 22 '21 15:10 tigerAndBull

可以优化为参数自动调整,但是意义不是很大

tigerAndBull avatar Oct 22 '21 15:10 tigerAndBull

作者你好,我这边用了CHTCollectionViewDelegateWaterfallLayout实现的瀑布流,然后更改了代理方法实现了骨架。但是我目前碰到了一个问题,就是我的骨架cell高度会随我设置的高度来,但是里面的元素不会跟着高度变化而变化,只会按下标0的高度固定展示元素。 比如我cell上有一个UIView,我设置的高度是cell高度-20,那么假如下标0的cell高度为100,下标1的cell高度为200的话,这个UIView的高度也只会固定展示为80。请问这个是我写的有问题吗?

Pengjun1993 avatar Jul 03 '23 08:07 Pengjun1993