- (void)addWKWebView
{
_webView = [[WKWebView alloc] initWithFrame:CGRectMake(, , SCREEN_WIDTH, 0.1)];
[_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_activityModel.shareLink]]];
_webView.scrollView.scrollEnabled = NO;
_webView.UIDelegate = self;
_webView.navigationDelegate = self;
[_tableView setTableHeaderView:_webView];
[SVProgressHUD show];
} - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
[webView evaluateJavaScript:@"document.getElementById(\"content\").offsetHeight"
completionHandler:^(id _Nullable result,NSError * _Nullable error) {
// 获取页面高度,并重置webview的frame
_webViewHeight = [result doubleValue];
CGRect frame = webView.frame;
frame.size.height = _webViewHeight;
webView.frame = frame;
[_tableView beginUpdates];
[_tableView setTableHeaderView:_webView];
[_tableView endUpdates];
[self getActivityComments];
}];
} - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation{ } - (void)addTableView
{
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(,, SCREEN_WIDTH, SCREEN_HEIGHT-- ) style:UITableViewStylePlain]; [_tableView setBackgroundColor:[UIColor clearColor]];
[_tableView setDelegate:self];
[_tableView setDataSource:self];
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
_tableView.separatorColor = SEPARATOR_COLOR_SYSTEM;
[self.view addSubview:_tableView];
[self loadLoadMoreFooter:_tableView action:@selector(loadMoreData)]; }

WKWebview 拼接tableview,获取web内容高度的更多相关文章

  1. iOS 【终极方案】精准获取webView内容高度,自适应高度

    前言:是这样的,刚写完上一篇文章还没缓过神来,上一篇文章我还提到了,想和大家聊聊原生+H5如何无缝连接的故事.结果我朋友就给我发了两篇他的作品.他的做法也都有独到之处.好的文章都是这样,让你每次看都能 ...

  2. iOS【野路子】精准获取webView内容高度,自适应高度

    关于WebView内容高度的获取,相信很多人都踩过坑,无法获取到准确高度,导致页面布局出现差错,搜到的资料很多但都无法解决问题,以下是个人经验总结: 项目需求实现H5文章&原生评论效果,文章是 ...

  3. iOS-tableview【终极方案】精准获取webView内容高度,自适应高度

    关于WebView内容高度的获取,相信很多人都踩过坑,无法获取到准确高度,导致页面布局出现差错,搜到的资料很多但都无法解决问题,以下是个人经验总结: 项目需求实现H5文章&原生评论效果,文章是 ...

  4. java保存获取Web内容的文件

    package com.mkyong;   import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.F ...

  5. swift 如何获取webView的内容高度

    应用中如果使用webView,要想获取其内容高度,就要实现其代理方法, 首先添加代理UIWebViewDelegate 然后给代理赋值 webView.delegate = self 实现代理方法: ...

  6. UIWebView如何获取内容高度

    iOS UIWebView如何获取到内容的高度呢?我们经常会遇到项目中需要使用UIWebView来加载H5页面,但是页面的高度并不确定,而我们前端需要根据内容的高度呈现出来,且不允许webview滚动 ...

  7. js获取窗口滚动条高度、窗口可视范围高度、文档实际内容高度、滚动条离浏览器底部的高度

    1.获取窗口可视范围的高度 //获取窗口可视范围的高度 function getClientHeight(){ var clientHeight=0; if(document.body.clientH ...

  8. 获取iframe子页面内容高度给iframe动态设置高度

    <!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <meta nam ...

  9. Android中竖线随内容高度变化而变化的问题和解决办法

    项目中要求显示竖线,并且竖线高度不确定,竖线的高度要随着内容的变化而变化.不能使用match_parent 充满,也不能在布局中写死,此时使用 android:layout_height=" ...

随机推荐

  1. Decorator实现AOP编程。

    Program.cs class Program { static void Main(string[] args) { User user = " }; var processor = T ...

  2. 改变ubuntu终端显示语言(桌面系统是中文,终端提示是英文)

    打开终端: $ vi .bashrc 最后添加 if [ "$TERM"="linux" ] ;then export LANGUAGE=en_US expor ...

  3. NT6 HDD Installer(硬盘装系统工具)装系统

    32位系统上使用虚拟光驱装不了64位的,使用NT6就可以.

  4. win10下 homestead 安装

    1.安装VirtualBox 和 Vagrant 2.git或者composer安装 homestead git clone https://github.com/laravel/homestead. ...

  5. jquery时间控件datepicker

    配置文件 $("#joinedTime").datepicker({ inline: true, yearRange: "1996:2016", showBut ...

  6. UVa 12118 检查员的难题(dfs+欧拉回路)

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  7. 《C与指针》第十一章练习

    本章问题 1.在你的系统中,你能够声明的静态数组最大的长度能达到多少?使用动态内存分配,你最大能获取的内存块有多少? answer: This will vary from system to sys ...

  8. LeetCode 【Single Number I II III】

    Given an array of integers, every element appears twice except for one. Find that single one. 思路: 最经 ...

  9. new 与 malloc 的区别

    1, 申请内存所在的位置 new 操作符从自由存储区上为对象动态分配内存空间,而 malloc 函数从堆上动态分配内存.自由存储区是C++基于 new 操作符的一个抽象概念,而堆是操作系统中的术语,是 ...

  10. windows下安装Composer

    1.下载https://getcomposer.org/composer.phar 2.复制到php.exe所在目录 3.在php.exe所在目录新建composer.bat文件 4.打开cmd,跳转 ...