updated tab
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
76c3205921
commit
a8e1cf9b48
@ -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() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user