获取textview自动识别的手机号

//文字内容

self.content = [[UITextView alloc] initWithFrame:CGRectMake(55, KViewContentY, LNScreenWidth-110, 80)];

//RGB_Color(80.0, 113.0, 126.0);

//    [self.content setTitleColor:[UIColor colorWithRed:80/255.0 green:113/255.0 blue:126/255.0 alpha:1] forState:UIControlStateNormal];

self.content.tag = 1011;

self.content.font = [UIFont systemFontOfSize:CONTENTSIZE];

self.content.backgroundColor=[UIColor clearColor];

self.content.editable = NO;

self.content.dataDetectorTypes = UIDataDetectorTypeAll;

self.content.font = [UIFont systemFontOfSize:15];

self.content.scrollEnabled = NO;

self.content.delegate = self;

self.content.userInteractionEnabled = YES;

[self.content setBackgroundColor:[UIColor clearColor]];

[view addSubview:self.content];


- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange {

NSLog(@"url :%@",URL);

if ([[URL scheme] isEqualToString:@"tel"]) {

if (_delegate && [_delegate respondsToSelector:@selector(callPhone)]) {

[_delegate callPhone];

}

return NO;

}

return YES;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、禁止手机睡眠[UIApplication sharedApplication].idleTimerDisabl...
    DingGa阅读 1,143评论 1 6
  • 用法: 先添加指针视图,转盘背景和开始按钮。按钮的点击事件里设置开始动画,在动画开始的代理方法中让开始按钮不响应点...
    全栈的猫南北阅读 1,624评论 1 3
  • iOS开发系列--网络开发 概览 大部分应用程序都或多或少会牵扯到网络开发,例如说新浪微博、微信等,这些应用本身可...
    lichengjin阅读 3,721评论 2 7
  • 大米在中国代表什么?是一日三餐的饭。饭能填饱肚子。所以老百姓吃了米饭,才有力气干活。大米在中国象征“土地”。在王土...
    523aa44f6726阅读 362评论 0 0
  • 2017年 8月9日(农历闰六月初十八)星期三天气:晴 读经人:璐萱锦雯妈 读经第十五周第3天,累积106天 写读...
    璐萱锦雯妈阅读 191评论 0 0