alex alex - 10 months ago 105
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.


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