dataDetectorTypes
来源:互联网 发布:网络用词pa是什么意思 编辑:程序博客网 时间:2024/05/22 16:25
UIWebView、UITextView都有dataDetectorTypes属性,设置了该属性,系统可以自动检测电话、链接、地址、日历、邮箱。并且可以点击,当点击的时候可以在API中自定义事件,下面以UITextView为例.
- (void)viewDidLoad{ [super viewDidLoad]; //UIWebView有dataDetectorTypes属性,UITextView也有dataDetectorTypes属性。 UITextView *textView=[[UITextView alloc] initWithFrame:self.view.bounds]; textView.delegate=self; textView.font=[UIFont systemFontOfSize:14]; textView.editable=NO; textView.text=[NSString stringWithFormat:@"%@%@%@%@\n\n\n%@",@"\n\n\n我的手机号是:13122718991 \n\n\n",@"我的博客是:www.baidu.com\n\n\n",@"上海市浦东新区盛夏路570号\n\n\n",[NSDate date],@"我的邮箱:2365178852@qq.com"]; textView.dataDetectorTypes=UIDataDetectorTypeAll; [self.view addSubview:textView];}#pragma mark - UITextViewDelegate-(BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange{ NSLog(@"url=%@",URL); return YES;}
0 0
- dataDetectorTypes
- 使用UITextView的dataDetectorTypes实现超链接,及uiwebview的dataDetectorTypes
- UITextView使用dataDetectorTypes属性时的问题
- 使用UITextView的dataDetectorTypes实现超链接需要注意的事项!
- db2 import 五种方式详解
- 世界名画陈列馆问题
- dom4j解析xml文件
- 发送AVC和AAC到流媒体服务器的流程图和设计结构
- 服务器端HttpServletResponse对象编码发送信息及浏览器端解码显示信息原理剖析
- dataDetectorTypes
- Android使用AsyncTask与Thread的区别(再用new Thread要舵手!)
- STM32学习笔记(1):通用定时器TIMx
- android genymotion教程之神坑
- C++primer plus第六版课后编程练习答案11.5和11.6
- Xcode7如何添加PCH文件以及解决添加后定义的宏使用不了的问题
- android Textview 使用之一:伸缩效果
- TCP中的RST标志(Reset)详解
- Disruptor使用指南