Chris
Chris

Reputation: 5617

UIDataDetectorTypeLink not working - iPhone

I am using the following sample code to add a link to a UITextView in a UITableViewCell, but it is not creating a link. I have done this before without issues... Has something changed with the recent iOS upgrade?

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

Upvotes: 0

Views: 2792

Answers (1)

user207616
user207616

Reputation:

tried simply putting this code in a subview on a normal view and works great for me (iOS 4.2), maybe the bug is somewhere else (or maybe frame is empty)

//EDIT: and tried for content view in TableViewCell, works also great

Just to have the question (maybe) solved: you have to reset myView.dataDetectorTypes = UIDataDetectorTypeLink; every time you reload the table.

Upvotes: 1

Related Questions