Swift 4
Multiply the collectionView's frame width/height in an implementation of the sizeForItemAt
method.
class yourClassName: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: self.myCollectionView.frame.height / 6 * 5, height: self.myCollectionView.frame.height / 6 * 5)
}
}
self.myCollectionView
is the reference from you collection view Item
it's important to implement UICollectionViewDelegateFlowLayout
And because it will not fit another cell you will have only one row.