DK
Size: a a a
DK
S
NP
S
DK
DK
NP
НС
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
var numberOfColumns: CGFloat = 3
if UIScreen.main.bounds.width > 320 {
numberOfColumns = 4
}
let spaceBetweenCells: CGFloat = 10
let padding: CGFloat = 40
let cellDimension = ((collectionView.bounds.width - padding) - (numberOfColumns - 1) * spaceBetweenCells) / numberOfColumns
return CGSize(width: cellDimension, height: cellDimension)
}
. вот держи пример, под себя подгонишь.NP
DK
НС
DK
S
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
var numberOfColumns: CGFloat = 3
if UIScreen.main.bounds.width > 320 {
numberOfColumns = 4
}
let spaceBetweenCells: CGFloat = 10
let padding: CGFloat = 40
let cellDimension = ((collectionView.bounds.width - padding) - (numberOfColumns - 1) * spaceBetweenCells) / numberOfColumns
return CGSize(width: cellDimension, height: cellDimension)
}
. вот держи пример, под себя подгонишь.S
DK
DK
S
NP
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
var numberOfColumns: CGFloat = 3
if UIScreen.main.bounds.width > 320 {
numberOfColumns = 4
}
let spaceBetweenCells: CGFloat = 10
let padding: CGFloat = 40
let cellDimension = ((collectionView.bounds.width - padding) - (numberOfColumns - 1) * spaceBetweenCells) / numberOfColumns
return CGSize(width: cellDimension, height: cellDimension)
}
. вот держи пример, под себя подгонишь.DK
DK