Comments (2)
WKWebView 是异步计算的,比如在FinishNavigation中获取contentSize,就不一定是最终的大小。所以一个比较合理的办法就是监听WKWebView的contentSize,判断contentSize是否更新,并且使用新的value。其中如果contentSize的height大于frame.size.height,其实页面的高度就是contentSize.height. 直接使用即可;如果等于甚至小于frame.size.height,就需要用JS辅助判断一下了。总的来说,还是要注意时序问题,因为FinishNavigation不代表页面渲染完成。不知道是不是这个问题,可以试试
from hybridpagekit.
我之前是监听WKWebView的contentSize的,但是出现了一些问题,所以后来改用了js方法获取高度,现在用这个框架, CGFloat jsHeight = ((NSNumber *)result).floatValue; 这个返回的高度,只有第一次是看上去是对的,之后一直是ContainerScrollVie的高度,就是下面有大片的空白,但是偶尔是对的,但是几率很小,不知道是什么原因
from hybridpagekit.
Related Issues (20)
- 内存警告处理不友好 HOT 5
- 请问下,如何设置webview的WKWebViewConfiguration在NestingWebViewController的使用方法里? HOT 1
- 前端页面通过JS滚动web的话,然后再次手势滑动,会有闪一下的效果,这个没考虑到 HOT 1
- 希望添加 WKWebViewExtension的调用支持 HOT 1
- 是否有支持swift计划 HOT 1
- 请问如何注入js方法到webview HOT 1
- 懒加载图片的时候注入加载图片的js HOT 1
- 有两个框架相关的问题咨询一下 HOT 1
- 给TableView添加tableHeaderView和FooterView可能会导致计算出现问题 HOT 2
- 你好 有关wkwebView设置cookies问题 HOT 1
- 私有api会有审核风险么 HOT 1
- 标题不能自适应高度
- 在默认缓存策略下,重用后的webView会忽略304缓存,每次都会重新获取主html
- 支持标签页控件吗? HOT 1
- 支持识别白屏吗
- Android端有类似的框架吗?
- 进入界面后定位到指定的Component
- 有类似的swift版本吗?
- 这个方法是私有方法么?会影响上架么?? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hybridpagekit.