UIView that takes you to anchor link

懵懂的女人 提交于 2019-12-11 07:22:49

问题


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?

thanks,

fbr


回答1:


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

You can execute Javascript in your UIWebView with this method

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

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



来源:https://stackoverflow.com/questions/1802220/uiview-that-takes-you-to-anchor-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!