How to analyze and display hyperlinks (phone number / email address, etc.) in UILabel?

You can enter text almost everywhere on the iPhone, and the OS recognizes part of the text as hyperlinks (for example, phone numbers, email addresses). However, I tested this in my application with UILabel and it does not work. How to activate it?

Does iphone sdk provide this functionality out of the box or do I need to execute parsing logic myself (which is a lot)?

+5
source share
3 answers

You can use UITextView as follows:

UITextView *myView = [[UITextView alloc] initWithFrame: frame];
myView.text = @"this is http://google.com link";
myView.editable = NO;
myView.dataDetectorTypes = UIDataDetectorTypeLink;
//cell is the TableView cell    
[cell.contentView addSubview:myView];
[myView release];
+16
source

You might want to check out Styled Labels in a Three20 project .

0

Take a picture using UIWebView.

-3
source

All Articles