From cfcfc3e92848b19e3530317c17ecc47f793e6512 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Tue, 4 Apr 2023 13:29:48 -0500 Subject: [PATCH] Fixes incorrect cell height for some News items We need to take layoutMargins into account when calculating the height of the prototype cell. --- AltStore/News/NewsViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AltStore/News/NewsViewController.swift b/AltStore/News/NewsViewController.swift index 347d605f..945a0822 100644 --- a/AltStore/News/NewsViewController.swift +++ b/AltStore/News/NewsViewController.swift @@ -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]) }