Quantcast
Channel: Check if a UIScrollView reached the top or bottom - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by ytbryan for Check if a UIScrollView reached the top or bottom

$
0
0

If you want the code in swift:

override func scrollViewDidScroll(scrollView: UIScrollView) {    if (scrollView.contentOffset.y >= (scrollView.contentSize.height - scrollView.frame.size.height)) {        //reach bottom    }    if (scrollView.contentOffset.y <= 0){        //reach top    }    if (scrollView.contentOffset.y > 0 && scrollView.contentOffset.y < (scrollView.contentSize.height - scrollView.frame.size.height)){        //not top and not bottom    }}

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>