最佳答案
您必须创建一个 json 解析器并为每个图像创建一个 NSTextAttachment
:
let textAttachment = NSTextAttachment()
textAttachment.image = yourImage
let attrStringWithImage = NSAttributedString.init(attachment: textAttachment)
attributedString.replaceCharactersInRange(NSMakeRange(6, 1), withAttributedString: attrStringWithImage)
textView.attributedText = attributedString
关于xcode - 将图像从 JSON 添加到文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32308492/