I use a UITextView
that is attached to a UITableViewCell
with a configuration as shown below:
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;
Now I would like to use text kit feature to detect taps on custom links in my attributed text (http://www.raywenderlich.com/48001/easily-overlooked-new-features-ios-7#textViewLinks) and - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
to identify a drilldown if a customer clicks somewhere in the UITableViewCell
where there is no custom link.
Unfortunately [UITextView setUserInteractionEnabled:YES]
makes the textview swallow all touches. What is the best approach to achieve this? I thought of writing a custom UITextView
Class, and use UITextView
delegates, but how can I then identify if the super class handles the press on a link already and to block a drilldown?
THX,
Jan