added check for change of scaledFonts
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a09d77760d
commit
61e843f8f8
@ -53,6 +53,8 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
||||
|
||||
open var attributes: [any LabelAttributeModel]? { nil }
|
||||
|
||||
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
||||
|
||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||
|
||||
open var userInfo = [String: Primitive]()
|
||||
@ -177,6 +179,7 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
||||
//create the primary string
|
||||
let mutableText = NSMutableAttributedString.mutableText(for: text ?? "No Text",
|
||||
textStyle: textStyle,
|
||||
useScaledFont: useScaledFont,
|
||||
textColor: textColor,
|
||||
alignment: titleLabel?.textAlignment ?? .center,
|
||||
lineBreakMode: titleLabel?.lineBreakMode ?? .byTruncatingTail)
|
||||
|
||||
@ -27,6 +27,8 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
||||
|
||||
open var useAttributedText: Bool = false
|
||||
|
||||
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
||||
|
||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||
|
||||
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
||||
@ -89,6 +91,13 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
||||
//--------------------------------------------------
|
||||
open func initialSetup() {
|
||||
if !initialSetupPerformed {
|
||||
//register for ContentSizeChanges
|
||||
NotificationCenter
|
||||
.Publisher(center: .default, name: UIContentSizeCategory.didChangeNotification)
|
||||
.sink { [weak self] notification in
|
||||
self?.setNeedsUpdate()
|
||||
}.store(in: &subscribers)
|
||||
|
||||
backgroundColor = .clear
|
||||
numberOfLines = 0
|
||||
lineBreakMode = .byWordWrapping
|
||||
@ -135,6 +144,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
||||
//create the primary string
|
||||
let mutableText = NSMutableAttributedString.mutableText(for: text,
|
||||
textStyle: textStyle,
|
||||
useScaledFont: useScaledFont,
|
||||
textColor: textColorConfiguration.getColor(self),
|
||||
alignment: textPosition.textAlignment,
|
||||
lineBreakMode: lineBreakMode)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user