且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否可以将哈希标记发送到UIWebView中的文件URL?

更新时间:2021-12-25 23:03:38

我没试过这个但是如何在没有hashtag的情况下正常加载文件并用这样的东西实现UIWebViewDelegate?

I've not tried this but how about loading the file normally without the hashtag and implementing the UIWebViewDelegate with something like this?

- (void)webViewDidFinishLoad:(UIWebView *)webView {
   [webView stringByEvaluatingJavaScriptFromString:@"window.location.href = '#hashtag';"];
}

参考文献:

  • UIView that takes you to anchor link
  • Programmatically scroll to an Anchor Tag