UITextView linkTextAttributes font attribute not applied to NSAttributedString

后端 未结 8 663
暖寄归人
暖寄归人 2021-02-01 20:18

I have an NSAttributedString generated from HTML which includes some links. The attributed string is shown in a UITextView. I wish to apply a different font style f

8条回答
  •  难免孤独
    2021-02-01 21:13

    Updated for Swift 4:

    let originalText = NSMutableAttributedString(attributedString: textView.attributedText)
    var newString = NSMutableAttributedString(attributedString: textView.attributedText)
    
    originalText.enumerateAttributes(in: NSRange(0..

提交回复
热议问题