NSAttributedString changed font unexpectedly after inserting Image

后端 未结 4 1436
死守一世寂寞
死守一世寂寞 2021-01-02 20:54

I am using Text Kit in iOS 7 to create a rich text editor. Following is the problem.

At first, then font size is 16:

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-02 21:21

    This is apparently a bug. Here is a workaround I found. Adding the correct font attributes one more time after inserting image will fix it.

    self.contentTextView.textStorage.addAttributes(self.contentTextView.typingAttributes, range: mEditingRange)
    

提交回复
热议问题