Detect UIScrollview bottom reached
If you want to detect them 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}}
Carlos answer is better.
For Swift 4.x you must change method name:
func scrollViewDidScroll(_ scrollView: UIScrollView) { if (scrollView.contentOffset.y + 1) >= (scrollView.contentSize.height - scrollView.frame.size.height) { //bottom reached } }
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { float bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height; if (bottomEdge >= scrollView.contentSize.height) { // we are at the end }}