In iOS, UIKit-UIDataDetectors (Data detector) changes the phone number, email address, and website address to a link. iosuikit
1. It is used for UITextView and UIWebView. The attribute name is dataDetetorTypes.
2. This attribute can be used to change text that matches the phone number, email address, URL, and date format to link text.
3. after clicking the phone number, dial out the phone number. After clicking the website address, it will be opened in Safari. The email will be opened in mail, and an ActionSheet will pop up on a date in the correct format, with a creation event, in the Calendar, there are three options: Show, and copy.
4. Example:
UITextView * textView = [[UITextView alloc] initWithFrame: CGRectMake (20, 20,280,200)];
TextView. dataDetectorTypes = UIDataDetectorTypeAll;
TextView. font = [UIFont systemFontOfSize: 20];
TextView. editable = NO;
TextView. text = @ "my phone nmuber is + 8602980000000 \ r \ n" "my web site is www.xxxxxx.com. \ r \ n "" my email-address is XX@163.com "" I WAS BORN IS 1009-09-02 ";
// Add a Text View to the view
[Self. view addSubview: textView];
The effect is as follows: