diff --git a/VDS/Components/Tabs/Tab.swift b/VDS/Components/Tabs/Tab.swift index 1b7cda8d..3b61549b 100644 --- a/VDS/Components/Tabs/Tab.swift +++ b/VDS/Components/Tabs/Tab.swift @@ -20,7 +20,7 @@ extension Tabs { open var index: Int = 0 ///label to write out the text - open var label: Label = Label() + open var label: Label = Label().with { $0.updateStrategy = .alwaysImmediate } ///orientation of the tabs open var orientation: Tabs.Orientation = .horizontal { didSet { setNeedsUpdate() } } @@ -123,6 +123,8 @@ extension Tabs { //-------------------------------------------------- open override func setup() { super.setup() + updateStrategy = .alwaysImmediate + addSubview(label) accessibilityTraits = .button @@ -165,17 +167,26 @@ extension Tabs { label.text = text label.textStyle = textStyle label.textPosition = textPosition - label.textColor = textColorConfiguration.getColor(self) + label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() + label.sizeToFit() //constaints - labelWidthConstraint?.isActive = false + labelWidthConstraint?.deactivate() + labelLeadingConstraint?.deactivate() + labelTopConstraint?.deactivate() + labelBottomConstraint?.deactivate() + labelWidthConstraint = widthConstraint - labelWidthConstraint?.isActive = true labelLeadingConstraint?.constant = leadingSpace labelTopConstraint?.constant = otherSpace labelBottomConstraint?.constant = -otherSpace + labelWidthConstraint?.activate() + labelLeadingConstraint?.activate() + labelTopConstraint?.activate() + labelBottomConstraint?.activate() setNeedsLayout() + layoutIfNeeded() } open override func layoutSubviews() {