UITextView设置用于检测电话号码和超链接

时间:2011-05-20 04:31:27

标签: iphone objective-c ios interface-builder uitextview

我的UITextView在Interface Builder中检测电话号码和超链接的设置在哪里?我想我已经在某个地方看到了这个选项,但我忘记了。

2 个答案:

答案 0 :(得分:3)

Text View Attributes中有一个字段为Detection。从那里选择您喜欢的任何选项 - 电话号码,地址,活动,链接。

答案 1 :(得分:0)

这是我的代码。

-(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;
}
相关问题