【发布时间】:2015-09-11 06:08:00
【问题描述】:
我使用这个代码:
var textView = UITextView(x: 10, y: 10, width: CardWidth - 20, height: placeholderHeight) //This is my custom initializer
textView.text = "dsfadsaf www.google.com"
textView.selectable = true
textView.dataDetectorTypes = UIDataDetectorTypes.Link
textView.delegate = self
addSubview(textView)
问题是链接需要长按手势才能打开。我希望它像在 Facebook 应用程序中一样,只需轻按一下即可打开。
【问题讨论】:
-
This answer of Benjamin Bojko 可能会帮助你。
-
仅供参考 - 也可以create tappable links in UILabel。 (如果您只对数据检测器使用 UITextView。)
标签: ios swift uiwebview uitextview datadetectortypes