Where is the setting for my UITextView
to detect phone numbers and hyperlinks in Interface Builder? I think I've seen the option somewhere, but I forget where.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There is a field in the Text View Attributes
that reads Detection
. Select whatever options you like from there -- Phone Numbers, Addresses, Events, Links.
回答2:
here is my Code.
-(UITextView *) content {
if (!_content) {
_content = [[UITextView alloc] initWithFrame:self.view.bounds];
_content.font =[UIFont fontWithName:@"Arial" size:20];
_content.backgroundColor = [UIColor blackColor];
_content.editable = NO;
_content.dataDetectorTypes = UIDataDetectorTypeAll;
_content.text = @"my phone is 18882222999 \r\n and my website is http://www.stackoverflow.com \r\n and I was born 1918-08-22\r\n";
}
return _content;
}