rickytan / RTViewAttachment

Attach a custom UIView to text view
MIT License
47 stars 11 forks source link

RTViewAttachment in UILabel #1

Closed lucasdelucca closed 6 years ago

lucasdelucca commented 7 years ago

Hello!

How can I use this attachment inside of UILabel?

I trying this, but doesn't works:

let square = UIView(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
square.backgroundColor = .red
let attachment = RTViewAttachment(view: square)

let attributedText = NSAttributedString(attachment: attachment!)

label.attributedText = attributedText

Thank you!

rickytan commented 7 years ago

No, you can only use it with the provided RTViewAttachmentTextView, it does lots of work for you.