标签:
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error];//创建检测器,检测类型是linke(可改成检测别的) NSArray *matches = [detector matchesInString:textString options:0 range:NSMakeRange(0, textString.length)];//检测字符串 for (NSTextCheckingResult *match in matches) { if ([match resultType] == NSTextCheckingTypeLink) { NSRange matchRange = [match range];
//do something } }
标签:
原文地址:http://www.cnblogs.com/wangyutao/p/4396554.html