Giter Site home page Giter Site logo

Comments (2)

dequan1331 avatar dequan1331 commented on May 11, 2024

WKWebView 是异步计算的,比如在FinishNavigation中获取contentSize,就不一定是最终的大小。所以一个比较合理的办法就是监听WKWebView的contentSize,判断contentSize是否更新,并且使用新的value。其中如果contentSize的height大于frame.size.height,其实页面的高度就是contentSize.height. 直接使用即可;如果等于甚至小于frame.size.height,就需要用JS辅助判断一下了。总的来说,还是要注意时序问题,因为FinishNavigation不代表页面渲染完成。不知道是不是这个问题,可以试试

from hybridpagekit.

Lee0820 avatar Lee0820 commented on May 11, 2024

我之前是监听WKWebView的contentSize的,但是出现了一些问题,所以后来改用了js方法获取高度,现在用这个框架, CGFloat jsHeight = ((NSNumber *)result).floatValue; 这个返回的高度,只有第一次是看上去是对的,之后一直是ContainerScrollVie的高度,就是下面有大片的空白,但是偶尔是对的,但是几率很小,不知道是什么原因

from hybridpagekit.

Related Issues (20)

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.