检测NSString中的URL [英] Detect URL in NSString
本文介绍了检测NSString中的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前在 UITableViewCell
中使用 UITextView
以使链接可点击,但这是非常差的性能。
I'm currently using a UITextView
in a UITableViewCell
in order to make links clickable, but this is giving very poor performance.
所以我想知道是否可以检测到 NSString
中的链接,如果有链接,使用 UITextView
,否则只是使用 UILabel
。
So I was wondering if it's possible to detect links in a NSString
and if there is a link, use the UITextView
, otherwise just use a UILabel
.
推荐答案
当然。使用NSDataDetector( NSDataDetector类参考)
Absolutely. Use NSDataDetector (NSDataDetector Class Reference)
这篇关于检测NSString中的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文