Create tap-able “links” in the NSAttributedString of a UILabel?

问题:

I have been searching this for hours but I've failed.我已经搜索了几个小时,但我失败了。 I probably don't even know what I should be looking for.我可能甚至不知道我应该寻找什么。

Many applications have text and in this text are web hyperlinks in rounded rect.许多应用程序都有文本,在此文本中是圆角矩形中的网络超链接。 When I click them UIWebView opens.当我点击它们时UIWebView打开。 What puzzles me is that they often have custom links, for example if words starts with # it is also clickable and the application responds by opening another view.让我感到困惑的是,他们经常有自定义链接,例如,如果单词以 # 开头,它也是可点击的,应用程序通过打开另一个视图来响应。 How can I do that?我怎样才能做到这一点? Is it possible with UILabel or do I need UITextView or something else?是否可以使用UILabel或者我是否需要UITextView或其他东西?


解决方案:

参考一: https://en.stackoom.com/question/5GyN
参考二: https://stackoom.com/question/5GyN
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章