如何将UITextView中的文本设置为URL的链接 [英] How to set text in a UITextView as a link to a URL

查看:133
本文介绍了如何将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.

这篇关于如何将UITextView中的文本设置为URL的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆