Skip to content

How do I add custom images #17

Description

@Topwiz

I was adding image attachments with NSTextAttachment in my custom textView.(Like below)
let textAttachment = NSTextAttachment() textAttachment.bounds = CGRect(x: 0, y: (textView.font!.capHeight - image.size.height).rounded() / 2, width: image.size.width, height: image.size.height) textAttachment.image = image let attrStringWithImage = NSAttributedString(attachment: textAttachment) textView.textStorage.replaceCharacters(in: currentRange, with: attrStringWithImage)
Is there a way to add images(don't care if is it an NSTextAttachment or a suffixedAttachment) on the textView with TwitterTextEditor?

I found I can get hashtags with regex and place an UIImage or UIView after that hashtag. But I can't find a way how to add just UIImage itself like an NSTextAttachment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions