NSMutableAttributedString未附加在IOS 13中在iOS 12或更低版本中运行良好

时间:2019-12-09 11:50:20

标签: ios swift nsmutableattributedstring

下面的代码在iOS 12或更低版本的iOS上运行良好,但在iOS 13中无法附加,因为它仅打印First Line,而不能打印Extra Text

    let formattedString = NSMutableAttributedString()                                                                 
    formattedString.append(NSAttributedString(string: "First Line\n" ,
                                                          attributes:[NSAttributedStringKey.font:UIFont.systemFont(ofSize: 8.0), NSAttributedStringKey.foregroundColor : UIColor.white]))
    formattedString.append(NSAttributedString(string: "Extra Text", attributes: [NSAttributedStringKey.foregroundColor : UIColor.white]))
    self.setAttributedTitle(formattedString, for: .normal)

0 个答案:

没有答案