textView富文本点击事件

时间:2022-07-01 20:24:39

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 的富文本好像不能直接添加点击事件