最佳答案
在Swift中,您可以这样操作:
var attributedString = NSMutableAttributedString(string: "Your String")
let textAttachment = NSTextAttachment()
textAttachment.image = UIImage(named: "Your Image Name")
let attrStringWithImage = NSAttributedString(attachment: textAttachment)
attributedString.insert(attrStringWithImage, at: 0)
label.attributedText = attributedString
关于ios - 如何掩盖UILabel或UITextView的文本?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56522955/