UICollectionView estimatedItemSize - last cell is not aligned

前端 未结 8 1745
春和景丽
春和景丽 2020-12-29 02:41

I want to make a usual horizontalScrolling flowLayout UICollectionView with estimatedItemSize and preferredLayoutAttributesFittingAttributes in cell. But there is something

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 02:54

    You call super method but you did not use super returned layoutAttributes.

        [super preferredLayoutAttributesFittingAttributes:layoutAttributes];
    

    You can try to print out original layoutAttributes vs super's layoutAttributes. Sometimes, you don't need to call super function.

    Second, You can create custom flowlayout or set inset to let your cell align top. I did this in my project.

提交回复
热议问题