Fixes incorrect cell height for some News items

We need to take layoutMargins into account when calculating the height of the prototype cell.
This commit is contained in:
Riley Testut
2023-04-04 13:29:48 -05:00
committed by Nythepegasus
parent f97548fc3a
commit cfcfc3e928

View File

@@ -426,6 +426,10 @@ extension NewsViewController: UICollectionViewDelegateFlowLayout
return previousSize
}
// Take layout margins into account.
self.prototypeCell.layoutMargins.left = self.view.layoutMargins.left
self.prototypeCell.layoutMargins.right = self.view.layoutMargins.right
let widthConstraint = self.prototypeCell.contentView.widthAnchor.constraint(equalToConstant: collectionView.bounds.width)
NSLayoutConstraint.activate([widthConstraint])
defer { NSLayoutConstraint.deactivate([widthConstraint]) }