Date
Sep. 8th, 2024
 
2024年 8月 6日

Post: iOS 小知识: 获取网页内容高度

iOS 小知识: 获取网页内容高度

Published 12:10 Oct 14, 2014.

Created by @ezra. Categorized in #Programming, and tagged as #iOS.

Source format: Markdown

Table of Content

介绍一些 iOS 小知识。

获取 Web 页面内容高度

利用 JavaScript 来实现,一般写在 UIWebView 代理中。

- (void)webViewDidFinishLoad:(UIWebView *)webView  {
    CGFloat height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] doubleValue];
        // ...
}
Pinned Message
HOTODOGO
The Founder and CEO of Infeca Technology.
Developer, Designer, Blogger.
Big fan of Apple, Love of colour.
Feel free to contact me.
反曲点科技创始人和首席执行官。
程序猿、设计师、奇怪的博主。
苹果死忠、热爱色彩斑斓的世界。
如有意向请随时 与我联系