Add tap event to IOS NSMutableAttributedString

后端 未结 2 540
旧巷少年郎
旧巷少年郎 2021-01-07 03:38

I have an NSMutableAttributedString such as \"Bob liked your picture\".

I\'m wondering if I can add two different tap events to \"Bob\" and \"picture\". Ideally, tap

2条回答
  •  情书的邮戳
    2021-01-07 04:17

    The way I would handle it is using a standard NSString in a UITextView. Then taking advantage of the UITextInput protocol method firstRectForRange:. Then you could easily overlay an invisible UIButton in that rect and handle the action you'd like to take.

提交回复
热议问题