在UIWebView中滚动网页 [英] Scrolling a webpage inside UIWebView
问题描述
我有一个 UIWebView
和 UIButton
作为子视图添加到我的视图中。我的 UIWebView
中还有一个大型网页,是否可以通过点击 UIView
?
I have a UIWebView
and UIButton
added as subview to my View. I also have a large webpage displayed inside my UIWebView
, is it possible to scroll the webpage by clicking a button on the UIView
?
我想让网页滚动直到它到达文档的底部。
I want to make the webpage scroll untill it reaches the bottom of the document.
javascript使用的是: window.scrollTo(xPos,yPos);
The javascript to be used is : window.scrollTo(xPos, yPos);
是否可以进行javascript调用在按钮操作上将滚动 UIWebView
中的Web文档?
Is it possible to make a javascript call on the button action which will scroll the web document inside the UIWebView
?
推荐答案
您可以在UIWebview组件上使用它:
You can use that on your UIWebview component:
NSString *yourScript = [NSString stringWithFormat:@"javascript_method();"];
NSString* responseJS = [webView stringByEvaluatingJavaScriptFromString:yourScript];
这篇关于在UIWebView中滚动网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!