Code Monkey home page Code Monkey logo

Comments (7)

VolientDuan avatar VolientDuan commented on September 3, 2024

为了防止阻塞主线程可以把最后一句改成

[self performSelector:@selector(callback_webViewDidFinishLoad) withObject:nil afterDelay:0.1];

或者在加载完成的delegate方法中使用获取height

[webView evaluateJavaScript:@"document.body.offsetHeight" completionHandler:^(id data, NSError *error) {
    }];

from vdwebview.

VolientDuan avatar VolientDuan commented on September 3, 2024

原代码有问题 已提交修复版本1.0.2 谢谢你的指出

from vdwebview.

Ccmi avatar Ccmi commented on September 3, 2024

好的,了解!

from vdwebview.

Ccmi avatar Ccmi commented on September 3, 2024

老哥,这样延迟的方式还是会有问题的吧,不一定这0.1s 能把高度获取出来,还是得单独写一个获取高度的代理方法才能在真正获取完高度以后再调用;我的富文本高度在一千多左右,现在还是拿不到的,还是会先走finished 再走获取高度的回调

from vdwebview.

VolientDuan avatar VolientDuan commented on September 3, 2024

你说的有道理,我加一下,顺便改一下其它bug😁;不过我一般是直接使用下面方法获取高度

[webView evaluateJavaScript:@"document.body.offsetHeight" completionHandler:^(id data, NSError *error) {
    }];

from vdwebview.

Ccmi avatar Ccmi commented on September 3, 2024

我以前也是,但是框架里有了就直接用了呀😁,暂时先用这个代替一下;

from vdwebview.

VolientDuan avatar VolientDuan commented on September 3, 2024

好的,我加上了。毕竟我也经常用到获取高度的代理方法,哈哈!
以后有什么需求可以自己直接加的,提上来就可了,一起完善和学习嘛!

pod 'VDWebView', '~> 1.0.3'
/**
 webView 高度获取

 @param webView VDWebView
 @param height 内容高度
 */
- (void)webView:(VDWebView *)webView innerHeight:(CGFloat)height;

from vdwebview.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.