Comments (7)
为了防止阻塞主线程可以把最后一句改成
[self performSelector:@selector(callback_webViewDidFinishLoad) withObject:nil afterDelay:0.1];
或者在加载完成的delegate方法中使用获取height
[webView evaluateJavaScript:@"document.body.offsetHeight" completionHandler:^(id data, NSError *error) {
}];
from vdwebview.
原代码有问题 已提交修复版本1.0.2 谢谢你的指出
from vdwebview.
好的,了解!
from vdwebview.
老哥,这样延迟的方式还是会有问题的吧,不一定这0.1s 能把高度获取出来,还是得单独写一个获取高度的代理方法才能在真正获取完高度以后再调用;我的富文本高度在一千多左右,现在还是拿不到的,还是会先走finished 再走获取高度的回调
from vdwebview.
你说的有道理,我加一下,顺便改一下其它bug😁;不过我一般是直接使用下面方法获取高度
[webView evaluateJavaScript:@"document.body.offsetHeight" completionHandler:^(id data, NSError *error) {
}];
from vdwebview.
我以前也是,但是框架里有了就直接用了呀😁,暂时先用这个代替一下;
from vdwebview.
好的,我加上了。毕竟我也经常用到获取高度的代理方法,哈哈!
以后有什么需求可以自己直接加的,提上来就可了,一起完善和学习嘛!
pod 'VDWebView', '~> 1.0.3'
/**
webView 高度获取
@param webView VDWebView
@param height 内容高度
*/
- (void)webView:(VDWebView *)webView innerHeight:(CGFloat)height;
from vdwebview.
Related Issues (7)
- url加载不成功 HOT 1
- JS调OC,target-action回调方式无效 HOT 3
- 返回上一级报错 HOT 4
- demo中js调用OC方法无效 HOT 1
- self.webView.jsHandler unrecognized selector sent to instance HOT 9
- bridge方法不支持返回值? HOT 2
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 vdwebview.