UITextView setting to detect phone numbers and hyp

2019-07-17 08:32发布

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.

2条回答
放我归山
2楼-- · 2019-07-17 08:54

There is a field in the Text View Attributes that reads Detection. Select whatever options you like from there -- Phone Numbers, Addresses, Events, Links.

查看更多
看我几分像从前
3楼-- · 2019-07-17 08:54

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;
}
查看更多
登录 后发表回答