1.它用于UITextView和UIWebView,属性名为:dataDetetorTypes
2.此属性可以设定使符合电话、邮件、网址、符合格式的日期等文字变为链接文字。
3.电话号码点击后拨出电话,网址点击后会用Safari打开,电子邮件会用mail打开,而符合格式的日期会弹出一个ActionSheet,有创建事件,在Calendar中显示,和拷贝三个选项。
4.使用示例:
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";
//添加文本视图当视图上
[self.view addSubview:textView];
效果如下: