Reputation: 53
I have three CollectionViews
in a single ViewController
. If I now set the constraints, the amount of cells per column changes and that ruins my application. Is there a special way - without constraints - to handle that?
Upvotes: 0
Views: 44
Reputation: 100549
Implement
let scW = UIScreen.main.bounds.width
let scH = UIScreen.main.bounds.height
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize {
if collectionView == col1 {
return CGSize(width:<##>,height:<##>) // supply ratio of screen width/height
}
else ...
...
}
Upvotes: 1