NSMutableAttributedString 和添加文本链接
我有一个 NSMutableAttributedString,现在我想将链接添加到文本的某些部分。我如何添加到文本的链接,以便当用户触摸文本时我可以触发一些操作。我正在使用 iOS 4.2
提前致谢。 神道
I have a NSMutableAttributedString, Now I want to add Link to some portion of the text. how can i add a link to the text so that when the user touches the text i can fire some actions. I'm working in iOS 4.2
Thanks in Advance.
Shinto
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几个月前我做了一个库来处理这个确切的用例。然而,上周我不得不重新使用它,发现 CMTextLabel 不太用户友好。
https://github.com/pothibo/CMFramework/tree/master/CMKit/RichText
你可以看一下。如果您决定使用它并重构其中一些以使其更易于使用,请发送推送请求,我将合并它。
I did a library a few months back that dealt with that exact use case. However, I had to re-use it last week and found out that CMTextLabel isn't very user-friendly.
https://github.com/pothibo/CMFramework/tree/master/CMKit/RichText
You could have a look at it. If you decide to use it and refactor some of it to make it easier to use, send a push request and I'll merge it.