From 4abbe27bf1cb8125e2cfb4891c6f847b2fcc38df Mon Sep 17 00:00:00 2001 From: Isidore Baldado Date: Tue, 7 Jan 2020 10:49:29 -0500 Subject: [PATCH] Labels in header views sometimes became misaligned from the rest of the collection view content after rotation. The cause was header views were not always handling layoutMargin changes. This change is similar to what CollectionViewCell is already doing. --- Wikipedia/Code/CollectionViewHeader.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Wikipedia/Code/CollectionViewHeader.swift b/Wikipedia/Code/CollectionViewHeader.swift index 87364f524c0..f42f14eacf6 100644 --- a/Wikipedia/Code/CollectionViewHeader.swift +++ b/Wikipedia/Code/CollectionViewHeader.swift @@ -90,6 +90,11 @@ class CollectionViewHeader: SizeThatFitsReusableView { button.titleLabel?.font = UIFont.wmf_font(buttonTextStyle, compatibleWithTraitCollection: traitCollection) } + override func layoutMarginsDidChange() { + super.layoutMarginsDidChange() + setNeedsLayout() + } + override func sizeThatFits(_ size: CGSize, apply: Bool) -> CGSize { let additionalMargins: UIEdgeInsets switch style {