AjiSantosoIND / Wkwebview

Detect wkwebview scroll reach to top or bottom swift, objective c

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wkwebview detect scroll reach to top or bottom

How to use in Swift

In you'r scrollview delegate, must implement scrollview delegate for your webview.

func scrollViewDidEndDragging(_ scrollView: UIScrollView,
                                           willDecelerate decelerate: Bool) {
        self.webView.didScrollEnd { (atbottom, attop) in
            if atbottom {
                print("scroll bottom")
            } else if attop {
                print("scroll at top")
            }
        }
    }

How to use in Objective c

in your scrollview delegate mehtod scrollViewDidEndDragging add this code

[self.webView didScrollEnd:^(BOOL isScrolledAtBottom, BOOL isScrollAtTop) {
    NSLog(@"Scroll at Top = %d",isScrollAtTop);
    NSLog(@"Scroll at bottom = %d",isScrolledAtBottom);
  }];

About

Detect wkwebview scroll reach to top or bottom swift, objective c


Languages

Language:Swift 50.5%Language:Objective-C 49.5%