UIWebView, start function when scrolling

I have an app which display through a UIWebView a html page. But I need to know when a user starts to scroll in this UIWebView and start a specific function.


However I don't know how to detect this? I've tried to use UISwipeGestureRecognizer but it seems only to work with left and right, not up and down in the UIWebView.


On the internet I've found the scrollViewDidScroll function. But I can't get this working.


func scrollViewDidScroll(scrollView: UIScrollView) { 
if scrollView.contentSize.height - scrollView.contentOffset.y - scrollView.frame.size.height < 120 { 
 print("the end") 
 } 
else if scrollView.contentOffset.y < 120 { 
print("the beginning") 
 }
}


Anyone has a solution for this?

Replies

Is there a delegate you maybe have to implement for that function to work?

Assuming this is iOS, have you tried using WKWebView, instead?