title: Couldn't get the correct height of the wkWebView?
body: <p>I have read lots of articles about how to get height of the webView. Most of them use KVO to observe the contentSize. I also did that. </p>
  
  <p>1) create wkWebView and forbid webView's scrollView</p>
  
  <pre><code> lazy var webView: WKWebView = WKWebView()
  
   webView.scrollView.bounces = false
   webView.scrollView.isScrollEnabled = false
  
   webView.snp.makeConstraints({ (make) in
          make.left.right.equalTo(view)
          make.top.equalTo(headerView.snp.bottom)
          make.height.equalTo(AppDefaults.screenH - 64 - 44)
          make.bottom.equalTo(containView)
      })
  </code></pre>
  
  <p>2) add observer </p>
  
  <pre><code>webView.scrollView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
  
  override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
      if keyPath == "contentSize" {
          if let scroll = object as? UIScrollView {
              if scroll.contentSize.height &gt; 0 {
                  updateWebViewConstraints(scroll.contentSize.height)
              }
          }
      }
  }
  
  func updateWebViewConstraints(_ height: CGFloat) {
      webView.snp.remakeConstraints { make in
          make.left.right.equalTo(view)
          make.top.equalTo(headerView.snp.bottom)
          make.height.equalTo(height)
          make.bottom.equalTo(containView).offset(-44)
      }
  }
  </code></pre>
  
  <p>3) remove observer</p>
  
  <pre><code>deinit {
      webView.scrollView.removeObserver(self, forKeyPath: "contentSize")
  }
  </code></pre>
  
  <p>When I run the app, sometimes I can get the correct height of the webView which was show right. Like below images</p>
  
  <p><a href="https://i.stack.imgur.com/QEJE2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QEJE2.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/hpij6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hpij6.png" alt="enter image description here"></a></p>
  
  <p>But sometimes ,the height of the webView over the correct height , it cause webView have part of empty space. We can see the below images, it get the wrong contentSize,</p>
  
  <p><a href="https://i.stack.imgur.com/fuNq1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fuNq1.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/x6dJH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x6dJH.png" alt="enter image description here"></a></p>
  
  <p>And when I tap the nextButton to load the new content, it also keep the previous height. That's not good. Just like if the contentSize's height over the new content's height. It will not change.</p>
  
  <p>In order to compare wkWebView, so I have tried UIWebView, it was correct. So, I don't know how to solve that problem. Please give me some suggestions. Thanks</p>