updated tab
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
87ecc1e28a
commit
a9b39c0fbf
@ -44,7 +44,7 @@ extension Tabs {
|
||||
open var selected: Bool = false { didSet { setNeedsUpdate() } }
|
||||
|
||||
///The text label of the tab.
|
||||
open var text: String = "Tab" { didSet { setNeedsUpdate() } }
|
||||
open var text: String = "" { didSet { setNeedsUpdate() } }
|
||||
|
||||
///Minimum width for the tab
|
||||
open var minWidth: CGFloat = 44.0 { didSet { setNeedsUpdate() } }
|
||||
@ -52,6 +52,17 @@ extension Tabs {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
private var textStyle: TextStyle {
|
||||
if size == .medium {
|
||||
return .boldBodyLarge
|
||||
} else {
|
||||
//specs show that the font size shouldn't change however boldTitleSmall does
|
||||
//change point size between iPad/iPhone. This is a "fix" so each device will
|
||||
//load the correct pointSize
|
||||
return UIDevice.isIPad ? .boldTitleSmall : .boldTitleMedium
|
||||
}
|
||||
}
|
||||
|
||||
private var labelWidthConstraint: NSLayoutConstraint?
|
||||
private var labelLeadingConstraint: NSLayoutConstraint?
|
||||
private var labelTopConstraint: NSLayoutConstraint?
|
||||
@ -148,10 +159,12 @@ extension Tabs {
|
||||
}
|
||||
|
||||
open override func updateView() {
|
||||
guard !text.isEmpty else { return }
|
||||
|
||||
//label properties
|
||||
label.text = text
|
||||
label.textStyle = textStyle
|
||||
label.textPosition = textPosition
|
||||
label.textStyle = size.textStyle
|
||||
label.textColor = textColorConfiguration.getColor(self)
|
||||
|
||||
//constaints
|
||||
|
||||
Loading…
Reference in New Issue
Block a user