move logic up
This commit is contained in:
parent
84a300eba7
commit
592e0a9591
@ -251,6 +251,23 @@ public typealias ActionBlock = () -> ()
|
|||||||
attributedText = nil
|
attributedText = nil
|
||||||
originalAttributedString = nil
|
originalAttributedString = nil
|
||||||
text = labelModel.text
|
text = labelModel.text
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is to address a reuse issue with iOS 13 and up.
|
||||||
|
* Even if you set text & attributedText to nil, the moment you set text with a value,
|
||||||
|
* attributedText will hold a dirty value from a previously reused cell even if reset() is
|
||||||
|
* appropriately called.
|
||||||
|
* Only other reference found of issue: https://www.thetopsites.net/article/58142205.shtml
|
||||||
|
*/
|
||||||
|
if #available(iOS 13, *) {
|
||||||
|
// Case where no attributes are set in the model but attributedText has a value.
|
||||||
|
if attributedText != nil, let text = text {
|
||||||
|
let attributedString = NSMutableAttributedString(string: text)
|
||||||
|
attributedString.addAttribute(.underlineStyle, value: 0, range: NSRange(location: 0, length: text.count))
|
||||||
|
attributedText = attributedString
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hero = labelModel.hero
|
hero = labelModel.hero
|
||||||
Label.setLabel(self, withHTML: labelModel.html)
|
Label.setLabel(self, withHTML: labelModel.html)
|
||||||
isAccessibilityElement = hasText
|
isAccessibilityElement = hasText
|
||||||
@ -366,22 +383,6 @@ public typealias ActionBlock = () -> ()
|
|||||||
attributedText = attributedString
|
attributedText = attributedString
|
||||||
originalAttributedString = attributedText
|
originalAttributedString = attributedText
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This is to address a reuse issue with iOS 13 and up.
|
|
||||||
* Even if you set text & attributedText to nil, the moment you set text with a value,
|
|
||||||
* attributedText will hold a dirty value from a previously reused cell even if reset() is
|
|
||||||
* appropriately called.
|
|
||||||
* Only other reference found of issue: https://www.thetopsites.net/article/58142205.shtml
|
|
||||||
*/
|
|
||||||
if #available(iOS 13, *) {
|
|
||||||
// Case where no attributes are set in the model but attributedText has a value.
|
|
||||||
if labelModel.attributes == nil && attributedText != nil, let text = text {
|
|
||||||
let attributedString = NSMutableAttributedString(string: text)
|
|
||||||
attributedString.addAttribute(.underlineStyle, value: 0, range: NSRange(location: 0, length: text.count))
|
|
||||||
attributedText = attributedString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public static func setUILabel(_ label: UILabel?, withJSON json: [AnyHashable: Any]?, delegate: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
@objc public static func setUILabel(_ label: UILabel?, withJSON json: [AnyHashable: Any]?, delegate: DelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user