您可以通过使用URL的absoluteString属性来获取URL的字符串表示形式,如下所示:

func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
    let urlString = URL.absoluteString
    // 使用urlString进行其他操作
    return true
}
func textView_ textView UITextView shouldInteractWith URL URL in characterRange NSRange interaction UITextItemInteraction - Bool 获取URL的String

原文地址: https://www.cveoy.top/t/topic/hNWN 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录