Skip to content

Commit

Permalink
Labels in header views sometimes became misaligned from the rest of t…
Browse files Browse the repository at this point in the history
…he 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.
  • Loading branch information
Isidore Baldado committed Jan 7, 2020
1 parent af5f6c1 commit 4abbe27
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Wikipedia/Code/CollectionViewHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4abbe27

Please sign in to comment.