0

I want to add a UIButton to the end of NSAttributedString. I was unable to do that as NSAttachment only takes a UIImage.

So, I've added a UIImage to NSAttributedString as attachment and saved its reference. Now i want to obtain the position of this UIImage on UIScreen, UIWindow or Superview to put a UIButton at the position of image. Is it possible?

B K.
  • 534
  • 5
  • 18
Haseeb Iqbal
  • 1,455
  • 13
  • 20
  • Instead of putting the `button` in place of `imageView`, why don't you add `tap gesture` on `imageView` itself? – PGDev May 17 '19 at 10:53
  • Which imageView? NSAttachment only takes UIImage and there is no imageView. Which imageView are you referring to? – Haseeb Iqbal May 17 '19 at 11:01
  • Maybe with `textContainer(forGlyphAt:effectiveRange:)` and `lineFragmentRect(forProposedRect:at:writingDirection:remaining:)` you might find it. It's just a guess. – Larme May 20 '19 at 12:37

0 Answers0