ios - 检测 NSString 中的 URL

标签 ios regex cocoa-touch uilabel uitextview

我目前在 UITableViewCell 中使用 UITextView 以使链接可点击,但这会导致性能非常差。

所以我想知道是否可以检测 NSString 中的链接,如果有链接,请使用 UITextView,否则就使用 UILabel.

最佳答案

当然。使用 NSDataDetector ( NSDataDetector Class Reference )

关于ios - 检测 NSString 中的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11011355/

相关文章:

ios - 开发者计划从名字到公司,可能吗?

ios - Google Analytics 实时功能不起作用

RegEx 不超过 2 个相同的连续字符以及 a-Z 和 0-9

ios - UIScrollview delaysContentTouches 问题

ios - 我应该避免使用 new 来初始化我的对象吗?

ios - 对象为零,但代码解释不为零

ios - 更改 UICollectionViewCell 高度以适合 UILabel

regex - 在 R 中使用 stringr 提取特定单词周围的单词样本

php - 如何在不使用 strip_tags 的情况下从变量中删除 <div> 标签?

iphone - 如何列出 .a 文件中的文件