UITextView 添加到UITableViewCell上使用AttributedString点击链接不调用代理方法的处理方法及自定义link样式需要注意的问题

将UITextView添加UITableViewCell,使用AttributedString处理UITextView上的链接点击.如果点击链接没有调用(UITextView 的delegate设置没有问题的前提下).

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction

请检查UITextView 是否设置了selectable为YES.如果没有一定要设置成YES.

 

如果需要自定义link的样式 TextView的linkTextAttributes设置为@{}

 

 

原文地址:https://www.cnblogs.com/programmer-blog/p/13523623.html