读书人

UIWebView滚动究竟部的代码

发布时间: 2012-06-27 14:20:08 作者: rapoo

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

读书人网 >Web前端

热点推荐