6 Replies
      Latest reply on Feb 1, 2019 7:42 PM by KMT
      mgerchinhoren Level 1 Level 1 (0 points)

        I'm working in a email client app, we are migrating from UIWebView to WKWebView and we are having issue with the scroll of WKWebView.

         

        The app adds the email header (From, To, Subject controls) inside the webview.scrollview, it was working fine in UIWebView.

         

        Now in WKWebView I add the controls in the same way and I change the scrollview content Size with:

        - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {

              [self.bodyWebView evaluateJavaScript:@"document.readyState" completionHandler:^(id result, NSError *error) {

                    if (error == nil && result != nil) {

                            [self.bodyWebView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id result2, NSError *error2) {

                                if (error2 == nil && result2 != nil)

                                {

                                    CGFloat h = [result2 floatValue];

                                    dispatch_async(dispatch_get_main_queue(), ^ {

                                         self.bodyWebView.scrollView.contentSize =CGSizeMake(self.bodyWebView.scrollView.contentSize.width, h+ self.internalHeaderView.frameHeight);

                                    });

                                }

                            

                             

                            }];

                        }

                }];

               [self shiftWebViewSubviews];

            }

         

        I debuged and the size is setting fine, I see all the email content, but the scroll stop some lines before the end, the same as the header height.

         

        I tried overriding intrinsincContentSize in WKWebView, but doesn't work.