From a339884d1f4f83f7d51c40ed9c36f90050c9b229 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 26 Jun 2023 21:52:43 -0700 Subject: [PATCH] Fix ScrollingSegmentedControl being cut off at smaller the default dynamic type size Closes #410 --- Tusker/Views/ScrollingSegmentedControl.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tusker/Views/ScrollingSegmentedControl.swift b/Tusker/Views/ScrollingSegmentedControl.swift index 7dace042..a9d28d73 100644 --- a/Tusker/Views/ScrollingSegmentedControl.swift +++ b/Tusker/Views/ScrollingSegmentedControl.swift @@ -75,6 +75,13 @@ class ScrollingSegmentedControl: UIScrollView, UIGestureRecogni fatalError("init(coder:) has not been implemented") } + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + if traitCollection.preferredContentSizeCategory != previousTraitCollection?.preferredContentSizeCategory { + invalidateIntrinsicContentSize() + } + } + private func createOptionViews() { optionsStack.arrangedSubviews.forEach { $0.removeFromSuperview() }