textView富文本点击事件

NSDictionary * attDic = [NSDictionary dictionaryWithObjectsAndKeys:RGBCOLOR(31, 132, 204),NSForegroundColorAttributeName,[NSNumber numberWithInteger:NSUnderlineStyleSingle],NSUnderlineStyleAttributeName,@“url”,NSLinkAttributeName, nil];

如果想要跳转viewController

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
{
    if ([URL.scheme isEqualToString:@"url"]) {
        // Launch View controller
        return NO;
    }
    return YES;
}

====
label 的富文本好像不能直接添加点击事件
原文地址:https://www.cnblogs.com/huoran1120/p/5660509.html