Meenakshi Borade
Meenakshi Borade

Reputation: 97

ios 8 UITextView UIDataDetectorTypeLink not working

I am setting html text to UITextView and set UIDataDetectorTypeLink to DataDetectorTypes but its not working.below is code:`

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

Text value is "If you need assistance please contact XXXX at [email protected]" what am i doing wrong?

Upvotes: 0

Views: 1111

Answers (2)

Santu C
Santu C

Reputation: 2654

Please try with below way -

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

Upvotes: 0

Vizllx
Vizllx

Reputation: 9246

Just check this code, I found in this Link:- It's a work around but it works nice!

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.

Upvotes: 1

Related Questions