I am Trying to resize my cell based on the screen size so that there is only 2 cell per row. I am using the code
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: MyCollectionView.bounds.width / 2.2, height: MyCollectionView.bounds.height / 5.5)
}
This works and resizes to the different screen sizes. I run it on. however when you rotate into landscape mode it displays more than two cells per row.