【发布时间】:2014-06-18 18:21:51
【问题描述】:
我使用UITextView 附加到UITableViewCell 的配置如下所示:
cell.topicAndDescriptionTextView = [[UITextView alloc] initWithFrame:frame];
cell.topicAndDescriptionTextView.tag = 1;
cell.topicAndDescriptionTextView.attributedText = attrText;
cell.topicAndDescriptionTextView.scrollEnabled = NO;
cell.topicAndDescriptionTextView.editable = NO;
cell.topicAndDescriptionTextView.textContainer.lineFragmentPadding = 0;
cell.topicAndDescriptionTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0);
cell.topicAndDescriptionTextView.backgroundColor =[UIColor clearColor];
[cell.topicAndDescriptionTextView setUserInteractionEnabled:YES];
cell.topicAndDescriptionTextView.dataDetectorTypes = UIDataDetectorTypeAll;
现在我想使用文本工具包功能来检测对我的属性文本 (http://www.raywenderlich.com/48001/easily-overlooked-new-features-ios-7#textViewLinks) 和 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 中的自定义链接的点击,以在客户点击 UITableViewCell 中没有自定义的某处时识别向下钻取链接。
不幸的是 [UITextView setUserInteractionEnabled:YES] 让 textview 吞下所有的触摸。实现这一目标的最佳方法是什么?我想编写一个自定义的UITextView 类,并使用UITextView 代表,但是我如何才能确定超类是否已经处理了链接上的新闻并阻止向下钻取?
谢谢,
一月
【问题讨论】:
-
@Larme - 如果我这样做,我仍然会遇到 UITableView 向下钻取的吞咽触摸问题。有什么提示吗?
标签: ios objective-c uitableview uitextview textkit