您好我想在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)
}
}