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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章