removed default text and fix issue for empty strings

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-11-02 08:48:23 -05:00
parent caad16f4e9
commit 94bdb22fbd

View File

@ -158,9 +158,9 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
//clear the arrays holding actions //clear the arrays holding actions
accessibilityCustomActions = [] accessibilityCustomActions = []
if let text, !text.isEmpty {
//create the primary string //create the primary string
let mutableText = NSMutableAttributedString.mutableText(for: text ?? "No Text", let mutableText = NSMutableAttributedString.mutableText(for: text,
textStyle: textStyle, textStyle: textStyle,
useScaledFont: useScaledFont, useScaledFont: useScaledFont,
textColor: textColor, textColor: textColor,
@ -178,6 +178,11 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
//set the attributed text //set the attributed text
setAttributedTitle(mutableText, for: .normal) setAttributedTitle(mutableText, for: .normal)
setAttributedTitle(mutableText, for: .highlighted) setAttributedTitle(mutableText, for: .highlighted)
} else {
setAttributedTitle(nil, for: .normal)
setAttributedTitle(nil, for: .highlighted)
titleLabel?.text = nil
}
} }
} }