获取textview自动识别的手机号

2016-09-01  本文已影响437人  Q6尐漒

//文字内容

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;

}

上一篇 下一篇

猜你喜欢

热点阅读