NSAttributedString 使用 Swift 在 TextView 中的范围之后保留其属性

问题描述

我在文本视图中使用 Swift 中的属性文本字符串,一旦我向文本视图添加链接属性,无论用户在该链接属性之后写入什么,它仍将作为链接属性而不是普通属性,所以在这里我可以修复在我的链接属性添加分隔符(添加普通属性)的问题,但问题是我无法添加任何分隔符,因为我想将其用作 url。

attributeString.addAttribute(.link,value: url,range: NSRange(location: 0,length: attributeString.length))

please see this image for better understanding test2这个词还有link属性

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)