我想通过打开web视图来使所有UITextViews
处理链接点击,而不是打开Safari浏览器。我怎么能覆盖这个委托功能为我的应用程序内的所有UITextViews:如何覆盖UITextViewDelegate函数
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool
我希望把它的代码如下:
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool {
let webViewController = WebViewController()
webViewController.urlToLoad = URL
present(webViewController, animated: true)
return false
}
请详细解释...不明白你想要什么.....你的textview是否在同一个viewcontroller? –