I have ViewController
with collectionView
and collectionView
bottom, top, leading, trailing constraints to superview. And on iPhone 8 my screen look like this:
And for another devices all looks fine. But on iPhone X look like this:
I use this code for my cells:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let offset: CGFloat = 10
let width = collectionView.bounds.width / 3 - offset * 4
let a: CGFloat = width / 2
let b: CGFloat = a * 3 + a * 0.65
let height = b
return CGSize(width: width, height: height)
}
How to fix it?
Update
constraints: