fixed bug for Accessibility Elements in Label
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a71085f2b3
commit
f5380532ff
@ -314,8 +314,11 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
super.text = newValue
|
super.text = newValue
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//clear out accessibility
|
||||||
|
accessibilityElements?.removeAll()
|
||||||
accessibilityCustomActions = []
|
accessibilityCustomActions = []
|
||||||
|
|
||||||
//create the primary string
|
//create the primary string
|
||||||
let mutableText = NSMutableAttributedString.mutableText(for: newValue,
|
let mutableText = NSMutableAttributedString.mutableText(for: newValue,
|
||||||
textStyle: textStyle,
|
textStyle: textStyle,
|
||||||
@ -337,6 +340,10 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//clear out accessibility
|
||||||
|
accessibilityElements?.removeAll()
|
||||||
|
accessibilityCustomActions = []
|
||||||
|
|
||||||
let mutableText = NSMutableAttributedString(attributedString: newValue)
|
let mutableText = NSMutableAttributedString(attributedString: newValue)
|
||||||
|
|
||||||
applyAttributes(mutableText)
|
applyAttributes(mutableText)
|
||||||
@ -348,7 +355,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
private func applyAttributes(_ mutableAttributedString: NSMutableAttributedString) {
|
private func applyAttributes(_ mutableAttributedString: NSMutableAttributedString) {
|
||||||
actions = []
|
actions = []
|
||||||
|
|
||||||
if let attributes = attributes {
|
if let attributes {
|
||||||
mutableAttributedString.apply(attributes: attributes)
|
mutableAttributedString.apply(attributes: attributes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,7 +366,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
|
|
||||||
let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText)
|
let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText)
|
||||||
|
|
||||||
if let attributes = attributes {
|
if let attributes {
|
||||||
//loop through the models attributes
|
//loop through the models attributes
|
||||||
for attribute in attributes {
|
for attribute in attributes {
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user