collectionView
您好,我想像上面的图片一样显示多张图片。我可以在 的帮助下显示两行和三列UICollectionViewDelegateFlowLayout
,但无法做到这一点。非常感谢您的帮助。
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
switch indexPath.item {
case 0,1:
return CGSize(width: (UIScreen.main.bounds.width - 4) / 2, height: (UIScreen.main.bounds.width - 4) / 2)
default:
return CGSize(width: (UIScreen.main.bounds.width - 6) / 3, height: (UIScreen.main.bounds.width) / 3)
}
}