0

I have a long UIScrollView with multiple UIViews in it. How do I grab an action/event (i.e. call a method) when the bottom of the scrollview is reached?

cdub
  • 24,555
  • 57
  • 174
  • 303

2 Answers2

0

you need to check scrollview delegate method and also set its delegate to listen its delegate methods.

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    float currentEndPoint = scrollView.contentOffset.y + scrollView.frame.size.height;
    if (currentEndPoint >= scrollView.contentSize.height) {
        // end point reached
    }
}
Manish Agrawal
  • 10,958
  • 6
  • 44
  • 76
0

You can check it by, setting up UIScrollViewDelegate for you UIScrollView

- (void)viewDidLoad {
    [super viewDidLoad];
    [scrollview setDelegate:self];
    [scrollview setContentSize:CGSizeMake(scrollview.frame.size.width, 900)];
}

#pragma mark - Scrollview Delegate 
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    if (scrollView.contentOffset.y+scrollView.frame.size.height==scrollView.contentSize.height) {
        NSLog(@"You are at bottom with contnet goes up :%f",scrollView.contentOffset.y);
    }
}

Hope this help you.

Viral Savaj
  • 3,379
  • 1
  • 26
  • 39