UIWebView滚动到底部的代码

实现UIWebViewDelegate中的

- (void)webViewDidFinishLoad:(UIWebView *)webView{
    NSInteger height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] intValue];
    NSString* javascript = [NSString stringWithFormat:@"window.scrollBy(0, %d);", height];  
    [webView stringByEvaluatingJavaScriptFromString:javascript];
}

原文地址:
http://stackoverflow.com/questions/3594851/how-can-i-scroll-programmatically-to-the-bottom-in-a-uiwebview

你可能感兴趣的:(UIWebView)