※ Storyboardで設定したAttributedStringが反映されないことがある為再度コードにて設定し直す
extension UILabel {
/// Storyboardから設定したNSAttributedStringがUIに反映されない事がある為コードにて再度設定する処理
func resettingAttributes(text: String) {
if let attributedString = self.attributedText,
!attributedString.string.isEmpty {
let resettingAttributes = attributedString.attributes(at: 0, effectiveRange: nil)
self.attributedText = NSAttributedString(string: text, attributes: resettingAttributes)
}
}
}