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
|
open var index: Int = 0
|
||||||
|
|
||||||
///label to write out the text
|
///label to write out the text
|
||||||
open var label: Label = Label()
|
open var label: Label = Label().with { $0.updateStrategy = .alwaysImmediate }
|
||||||
|
|
||||||
///orientation of the tabs
|
///orientation of the tabs
|
||||||
open var orientation: Tabs.Orientation = .horizontal { didSet { setNeedsUpdate() } }
|
open var orientation: Tabs.Orientation = .horizontal { didSet { setNeedsUpdate() } }
|
||||||
@ -123,6 +123,8 @@ extension Tabs {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
updateStrategy = .alwaysImmediate
|
||||||
|
|
||||||
addSubview(label)
|
addSubview(label)
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
|
|
||||||
@ -165,17 +167,26 @@ extension Tabs {
|
|||||||
label.text = text
|
label.text = text
|
||||||
label.textStyle = textStyle
|
label.textStyle = textStyle
|
||||||
label.textPosition = textPosition
|
label.textPosition = textPosition
|
||||||
label.textColor = textColorConfiguration.getColor(self)
|
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
||||||
|
label.sizeToFit()
|
||||||
|
|
||||||
//constaints
|
//constaints
|
||||||
labelWidthConstraint?.isActive = false
|
labelWidthConstraint?.deactivate()
|
||||||
|
labelLeadingConstraint?.deactivate()
|
||||||
|
labelTopConstraint?.deactivate()
|
||||||
|
labelBottomConstraint?.deactivate()
|
||||||
|
|
||||||
labelWidthConstraint = widthConstraint
|
labelWidthConstraint = widthConstraint
|
||||||
labelWidthConstraint?.isActive = true
|
|
||||||
labelLeadingConstraint?.constant = leadingSpace
|
labelLeadingConstraint?.constant = leadingSpace
|
||||||
labelTopConstraint?.constant = otherSpace
|
labelTopConstraint?.constant = otherSpace
|
||||||
labelBottomConstraint?.constant = -otherSpace
|
labelBottomConstraint?.constant = -otherSpace
|
||||||
|
|
||||||
|
labelWidthConstraint?.activate()
|
||||||
|
labelLeadingConstraint?.activate()
|
||||||
|
labelTopConstraint?.activate()
|
||||||
|
labelBottomConstraint?.activate()
|
||||||
setNeedsLayout()
|
setNeedsLayout()
|
||||||
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user