I'm trying to get a custom view in an attributed string to be displayed on a textView. I am able to add an image with an NSTextAttachment, but it isn't what I want. I have a custom view that supports Gif's and Animated PNGs that I'd like to display between text.
Example:
text text text [customView] text [customView] text. <- In text view, preferably in attributed string
I would love some guidance as to where I should search specifically. So far I've seen related issues...
- Subclass NSTextAttachment: How to subclass NSTextAttachment?
- Use NSTextAttachmentContainer..?
- NSTextAttachmentCell - Only OSX
- Do manipulation in the text view
First, use
NSAttributedString
orNSMutableAttributedString
to show your RichText in subviews (such as UITextView/UILabel)Then, use
NSTextAttachment
to replace your image-script in text.BTW: if you use the
YYkit
for the RichText, you cannot use theYYAttachMentString
to replaceNSAttachMentString
, these are different things, theUITextView(UILabel)
cannot load theYYAttachMentString
. I'm looking for some way to show my gifs with theUITextView
(becauseYYKit
cannot load and preview netimage with a url,YYKit
always show empty which should be anetImage
, cripes!)