开发者

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 Tab开发者_开发技巧leView's cell    
[cell.contentView addSubview:myView];
[myView release];


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜