Hi I\'m trying to resize the cell via the auto layout.
I want display the cell by the 3 by 3.
First Cell\'s margin left=0
Last Cell\'s m
Swift 3 version code based on vacawama answer:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let cellsAcross: CGFloat = 3
let spaceBetweenCells: CGFloat = 1
let dim = (collectionView.bounds.width - (cellsAcross - 1) * spaceBetweenCells) / cellsAcross
return CGSize(width: dim, height: dim)
}