どのリンクが押されているかを検出する方法はありますか? 「次の」VC を開くことはできますが、どの単語かを検出できないようです。これは、リンクにする必要がある単語を検出する方法です。
NSArray *words = [cell.lblDescription.text componentsSeparatedByString:@" "];
for (NSString *word in words) {
if ([word hasPrefix:@"@"]) {
at = [cell.lblDescription.text rangeOfString:word];
[cell.lblDescription addLinkToURL:[NSURL URLWithString:@"action://at"] withRange:at];
}else if ([word hasPrefix:@"#"]) {
hash = [cell.lblDescription.text rangeOfString:word];
[cell.lblDescription addLinkToURL:[NSURL URLWithString:@"action://hash"] withRange:hash];
}
}
リンクリンクの方法は次のとおりです。
- (void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url {
if ([[url scheme] hasPrefix:@"action"]) {
if ([[url host] hasPrefix:@"hash"]) {
/* load help screen */
UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"viewTags" bundle:nil];
OIOI_VC_ViewTags *viewController =[storyboard instantiateViewControllerWithIdentifier:@"viewTags"];
viewController.str_word = ??????;
[self.navigationController pushViewController:viewController animated:YES];
}
}