How to detect touch on NSTextAttachment

前端 未结 7 900
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-14 03:24

What is the best way to detect when user taps on NSTextAttachment on iOS?

I think that one of the ways would be checking for the character on carret\'s

7条回答
  •  旧巷少年郎
    2020-12-14 03:32

    Use hitTest to get the touch in a subclassed UITextView. This avoids the issue of messing up the standard editing functions. From the position get the character index and then check the character for the attachment.

提交回复
热议问题