ios 8 UITextView UIDataDetectorTypeLink 不工作

ios 8 UITextView UIDataDetectorTypeLink not working

我正在将 html 文本设置为 UITextView 并将 UIDataDetectorTypeLink 设置为 DataDetectorTypes 但它不是 working.below 是代码:`

self.dictHelp =[NSMutableDictionary dictionaryWithDictionary:response];
[self.txtView setValue:[self.dictHelp valueForKey:@"HelpText"] forKey:@"contentToHTMLString"];
self.txtView.userInteractionEnabled = YES;
[self.txtView setDataDetectorTypes:UIDataDetectorTypeLink];`

文本值为"If you need assistance please contact XXXX at customerservice@xxxx.org" 我做错了什么?

只需检查这段代码,我在 Link 中发现:- 这是一个解决方法,但效果很好!

self.txtView.selectable = NO; // set it to NO clears all possible data detection work so far.
self.txtView.selectable = YES; // set it to YES so that actual links are detected.

请尝试以下方式 -

 self.txtView.text = nil;
 [self.txtView setValue:nil forKey:@"contentToHTMLString"];
 [self.txtView setValue:[self.dictHelp valueForKey:@"HelpText"] forKey:@"contentToHTMLString"];