alex alex - 1 year ago 217
Swift Question

Swift UIWebView detect scroll

Hello to everyone i have a

where i'm rendering a PDF.
I need a method that hide the GUI if the pdf is not at the beginning of the page and show it again if the
hit the top. How can i check this?
Sorry for bad english, i'm italian.

Answer Source

You can use scrollViewDelegate method scrollViewDidScroll for that like this way.

func scrollViewDidScroll(scrollView: UIScrollView) {

    if (scrollView.contentOffset.y == 0) {
        //Do what you want.

Note: Don't forgot to set scrollView delegate of webView like this self.webView.scrollView.delegate = self

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download