多尺寸 CollectionView 单元格

Multiple Sized CollectionView Cell

我想制作多个像图像一样大小的 UICollectionViewCells。

使用 collectionViewFlowLayout 并在 collectionViewFlowLayout 子类中创建一个函数,并从以下函数调用该函数来为单元格提供所需的大小

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize