Why isn’t WKWebView.scrollView.bounces working correctly?

I click the button to go to another Webview. However, I removed the bounce from the moved Webview, but it does not work.



First WKWebView

    var openSecondScreen : SecondWebViewController!
    var preloadCheck = false


    func openSecondScreen(){
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        openSecondScreen = storyboard.instantiateViewController(withIdentifier: "SecondWebViewController") as! SecondWebViewController
        openSecondScreen.delegate = self
        openSecondScreen.secondWKWebView.navigationDelegate = self
        preloadCheck = true


    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        if preloadCheck {
            self.navigationController?.pushViewController(openSecondScreen, animated: true)
            preloadCheck = false




Second WKWebView


@IBOutlet var secondWKWebView: WKWebView!

override func loadView() {
    secondWKWebView.uiDelegate = self
    secondWKWebView.navigationDelegate = self
    secondWKWebView.scrollView.delegate = self


extension SecondWebViewController: UIScrollViewDelegate{
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        scrollView.bounces = false




Scroll does not display the log. Therefore, the function does not work either.



I’m even setting it up in advance.But it didn’t work

    override func viewDidLoad() {
        secondWKWebView.scrollView.bounces = false

Powered by WPeMatico

You may also like...

Comments are closed.