Fix ScrollingSegmentedControl being cut off at smaller the default dynamic type size

Closes #410
This commit is contained in:
Shadowfacts 2023-06-26 21:52:43 -07:00
parent 1de586f907
commit a339884d1f
1 changed files with 7 additions and 0 deletions

View File

@ -75,6 +75,13 @@ class ScrollingSegmentedControl<Value: Hashable>: UIScrollView, UIGestureRecogni
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if traitCollection.preferredContentSizeCategory != previousTraitCollection?.preferredContentSizeCategory {
invalidateIntrinsicContentSize()
}
}
private func createOptionViews() { private func createOptionViews() {
optionsStack.arrangedSubviews.forEach { $0.removeFromSuperview() } optionsStack.arrangedSubviews.forEach { $0.removeFromSuperview() }