Как вставить NSTextAttachment в NSAttributedString?
Как мне вставить NSTextAttachment
в определенном месте в NSAttributedString
?
1 ответ
let attributedString = NSAttributedString(attachment: textAttachment)
let mutableAttributedText = NSMutableAttributedString(attributedString: textView.attributedText)
mutableAttributedText.replaceCharacters(in: selectedRange, with: attributedString)
textView.attributedText = mutableAttributedText