开发者

UIDataDetectorTypeLink not working - iPhone

开发者 https://www.devze.com 2023-01-31 01:43 出处:网络
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

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

精彩评论

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