UIView带你锚定链接 [英] UIView that takes you to anchor link

查看:124
本文介绍了UIView带你锚定链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个iPhone应用程序,我将我的HTML内容作为HTMLString加载到UIWebview中,并希望有一个UIView告诉UIWebview滚动到锚链接。我可以从已加载的HTML内容滚动到锚点链接,或者我必须使用URL中的锚点链接重新加载页面吗?

I'm developing an iPhone app where I have my HTML content loaded in a UIWebview as a HTMLString and would like to have a UIView that tells the UIWebview to scroll to an anchor link. Can I scroll to the anchor link from the already loaded HTML content or I would have to reload the page with the anchor link in the URL?

谢谢,

fbr

推荐答案

这是一个完整的猜测,但也许你可以制作UIWebView使用Javascript滚动?

This is a complete guess, but perhaps you could make the UIWebView scroll with Javascript?

您可以使用此方法在UIWebView中执行Javascript

You can execute Javascript in your UIWebView with this method

- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script

参见以编程方式滚动到锚标签,了解如何使用Javascript。

See Programmatically scroll to an Anchor Tag on how to use the Javascript.

这篇关于UIView带你锚定链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆