Swift 如何更改UITextView自动检测链接背景?
我正在尝试为UITextView中自动检测到的链接和提及添加背景色,我曾尝试执行以下代码,但它们不起作用Swift 如何更改UITextView自动检测链接背景?,swift,xcode,uitextview,swift5,nsattributedstring,Swift,Xcode,Uitextview,Swift5,Nsattributedstring,我正在尝试为UITextView中自动检测到的链接和提及添加背景色,我曾尝试执行以下代码,但它们不起作用 textView.linktexttributes=[nsattributestring.Key.foregroundColor:UIColor.green] 这是: UITextView.appearance().linktexttributes=[.backgroundColor:UIColor.red]
textView.linktexttributes=[nsattributestring.Key.foregroundColor:UIColor.green]
这是:
UITextView.appearance().linktexttributes=[.backgroundColor:UIColor.red]