我使用NSLinkAttributeName给textview插入了一个超链接。
insertString.addAttribute(NSLinkAttributeName, value: NSURL(string: textF1.text!)!, range: NSMakeRange(0, insertString.length))
但是这样的话,后来输入的text都变成了链接的样式
求问大神,如何在接下来的编辑中,取消超链接的样式。
PHPz2017-04-18 09:43:36
Looking at your code, the range should be textF1.length
----UPDATE-----
It is indeed a range problem. You should find the location of textF1.text in insertString. You can refer to the implementation here: http://stackoverflow.com/ques...