Ios TTtatAttributedLabel链接检测无法使用情节提要
我正在尝试将TTtatAttributedLabel集成到UITableViewCell中。这实际上只是一个简单的集成,我只想用TTTAttributedLabel替换旧的UILabel。这就是我所做的Ios TTtatAttributedLabel链接检测无法使用情节提要,ios,objective-c,tttattributedlabel,tttattritubedlabel,Ios,Objective C,Tttattributedlabel,Tttattritubedlabel,我正在尝试将TTtatAttributedLabel集成到UITableViewCell中。这实际上只是一个简单的集成,我只想用TTTAttributedLabel替换旧的UILabel。这就是我所做的 转到情节提要,在自定义UITableViewCell内选择UILabel,并将其类更改为TTtatAttributedLabel 返回UITableViewController子类,包括TTTAttributedLabel.h,并修改(UITableViewCell*)tableView:(UI
(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
像这样:
static NSString *CellIdentifier = @"Post";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
TTTAttributedLabel *label = (TTTAttributedLabel *)[cell viewWithTag:801];
label.text = [self.post valueForKey:@"content"];
label.enabledTextCheckingTypes = NSTextCheckingTypeLink;
label.userInteractionEnabled = YES;
label.delegate = self;
return cell;
但是链接检测不起作用。它只是纯文本。如何调试我做错的地方?我想您需要在启用了
的TextCheckingTypes=NSTextCheckingTypeLink之后设置文本
label.enabledTextCheckingTypes = NSTextCheckingTypeLink;
label.userInteractionEnabled = YES;
label.delegate = self;
label.text = [self.post valueForKey:@"content"];
你找到解决这个问题的办法了吗?我也看到了同样的事情——这似乎是一个时间问题。在能够检测和绘制链接之前,将显示单元格。这是显而易见的,因为当表格滚动时,所有未来的单元格都会正确地突出显示链接。