UITextView setting to detect phone numbers and hyp

2019-07-17 08:49发布

问题:

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;
}