如何将UITextView中的文本设置为URL的链接
问题描述:
我在UITextView中有一些文字,我希望显示为蓝色,并作为网站的链接。如何在界面构建器中执行此操作?
I have some text in a UITextView, that I would like to have show as blue, and serve as a link to a website. How do I do that in interface builder?
答
在Interface Builder中,选择UITextView,打开检查器,转到文本选中查看属性选项卡,然后选中共享检测链接。
In Interface Builder, select the UITextView, open the inspector, go to the Text View Attributes tab, then make share "Detect Links" is checked.
这仅适用于看起来像链接的项目( http://stackoverflow.com )
This only works for items that look like links (http://stackoverflow.com)
为了制作任意链接,你需要使用UIWebView。
For making arbitrary links, then you will want to use a UIWebView instead.