tags:

views:

512

answers:

4

Almost everywhere in the iPhone, you can type text and the OS will recognize portion of the text to be hyperlinks (phone numbers, email addresses for example). However I tested this in my own app with a UILabel and it doesn't work. How do I activate this?

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

A: 

Give it a shot with a UIWebView.

Reed Olsen
Is it proper to have a lot of UIWebView in a single screen? This control will be duplicated many times in a tableView
erotsppa
A: 

Might want to check out Styled Labels under the Three20 project.

Ramin
From what I can see in the source, that presents text with different styles but does nothing about presenting links.
Kendall Helmstetter Gelner
If you run the TTCatalog sample code, there's a section under "Styled Labels" that shows URLS automatically converted into live links. The styling can be controlled through CSS. It's much lighter weight than a UIWebView. Also, under "Table Cells" there's an external link cell that invokes an external URL.
Ramin
+5  A: 

You could 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's cell    
[cell.contentView addSubview:myView];
[myView release];
Danil Glinenko
A: 

I want to launch my own compose screen when a user clicks on a hyperlinked email address in UITextView. Is this possible? If yes, how do I do it?

prasadh