UITextView linkTextAttributes font attribute not applied to NSAttributedString

后端 未结 8 665
暖寄归人
暖寄归人 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:01

    for simple cases: (without horrible HTML use):

        let linkTextAttributes : [String : Any] = [
            NSForegroundColorAttributeName: UIColor.red,
            NSUnderlineColorAttributeName: UIColor.magenta,
            NSUnderlineStyleAttributeName: NSUnderlineStyle.patternSolid.rawValue
        ]
    
        self.infoText.linkTextAttributes = linkTextAttributes
    

提交回复
热议问题