UITextView with NSAttributedString and custom attributes not working

后端 未结 3 811
粉色の甜心
粉色の甜心 2021-02-08 23:25

When using a UITextView I try to add a custom attribute to an attributed string. However, all custom keys are lost after assigning to a UITextView\'s attributedText. Like this:<

3条回答
  •  无人共我
    2021-02-09 00:06

    UITextView does not really display attributed strings. Apple has an internal class NSHTMLWriter which converts the set NSAttributedString into HTML data which is then displayed by the content UIWebDocumentView (which is essentially Webkit)

    See my analysis here: http://www.cocoanetics.com/2012/12/uitextview-caught-with-trousers-down/

提交回复
热议问题