1

I'm facing a strange issue with UIWebView that on landscape, after I rotate the device from portrait its returns incorrect height. For portrait mode I'm returning the height and adjust the height of the UIWebView via constraint.

func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {

    let url = request.URL

    if navigationType == .Other {
      if url?.scheme == "ready" {

        print((url?.host?.floatValue)!)

        webViewHeight.constant = (url?.host?.floatValue)!

        if (!observing) {
          startObservingHeight()
        }

        return false
      }
    }
    return true
  }

Please see my full implementation, the entire View Controller class here . Loaded HTML can be seen here

el.severo
  • 2,202
  • 6
  • 31
  • 62

0 Answers0