我需要点击部分的文本TTTAttributedLabel
:
// initialize
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
...
// Attributed Message Label
NSMutableAttributedString *messageTextAttr =[row valueForKey:@"message_text_attr"];
cell.messageText.attributedText = messageTextAttr;
cell.messageText.delegate = self;
[messageTextAttr enumerateAttribute:NSLinkAttributeName inRange:NSMakeRange(0, messageTextAttr.length) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) {
if (value) {
[cell.messageText addLinkToURL:[NSURL URLWithString:value] withRange:range];
}
}];
...
}
// click event
- (void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url {
NSLog(@"link %@", [url absoluteString]);
NSLog(@"whole label %@", label);
}
但我只有链接和整个标签,但没有点击的部分(点击的文本部分)。我怎么才能得到它?