0

我已经实现了 UIWebView 并显示来自网络服务的内容,这是下面的代码

webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,320,460)];
webView.scalesPageToFit = YES;
webView.dataDetectorTypes = YES;
webView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
webView.delegate = self;

NSURL *targetURL = [NSURL URLWithString:delegate.S_Title];
request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];

但是,当我向下滚动到底部时,它没有滚动以显示 webview 显示的完整内容。

4

1 回答 1

0

试试这个,在你加载了内容之后,UIWebView你可以使用它的stringByEvaluatingJavaScriptFromString:方法来询问 html 文档的高度。这有点棘手,但应该可以。

你可以这样做:

NSInteger height = [[webView stringByEvaluatingJavaScriptFromString:
    @"document.body.scrollHeight"] integerValue];

滚动高度可能不是最好的。你有几个选择。试用此处提到的文档属性

于 2012-06-26T13:51:35.493 回答