OHAttributedLabel に sitename.com/abc.html のようなリンクを表示する必要があります。そして、このURLのsetLinkを次のようにしたい: userlink:sitename.com/abc.html
次に、ラベルのリンクをクリックし、UIWebView デリゲートで 2 回クリック アクションを返します。
ワンクリックアクションが必要です
何をすればよいでしょうか?
アップデート:
////seeingUrlString = @"sitename.com/abc.html";
[_tmpContentAttributeString setLink:[NSURL URLWithString:seeingUrlString] range:hyperLinkRange];
self.contentLabel.attributedText = _tmpContentAttributeString;
-(BOOL)attributedLabel:(OHAttributedLabel *)attributedLabel shouldFollowLink:(NSTextCheckingResult *)linkInfo
{
CustomWebView *_customWebViewa = [[CustomWebView alloc] init];
_customWebViewa.webView.scrollView.scrollEnabled = NO;
_customWebViewa.webView.scrollView.bounces = NO;
_customWebViewa.webView.frame = self.view.bounds;
NSString *_url = [linkInfo.URL absoluteString];
if (![_url hasPrefix:HTTPPrefix]) {
_url = [HTTPPrefix stringByAppendingString:_url];
}
_url = [NSString stringWithFormat:@"%@%@%@", _url, Slash, NoFollow];
[self loadWebView:_customWebViewa.webView url:_url];
return NO;
}
2 つのクリック アクション 1 つは OHAttributedLabel デリゲートから、もう 1 つはどこから来たのかわかりません ...
更新2:
実際には、OHAttributedLabel にリンク (sitename.com/abc.html など) を表示するだけで済みますが、このリンクは使用しないでください。ユーザーがクリック可能なリンクであることを確認し、リンクをタップすると、OHAttributedLabel デリゲートが実際に起動します。カスタム リンク URL をアップすると、カスタム リンク URL は次のようになります。
ユーザーリンク:sitename.com/abc.html
OAHAtrributedLabel で表示 URL を通常の文字列として扱いたい