UIScrollView, reaching the bottom of the scroll view

后端 未结 7 1618
暗喜
暗喜 2020-12-07 16:05

I know the Apple documentation has the following delegate method:

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;      // called when scroll         


        
7条回答
  •  感动是毒
    2020-12-07 17:04

    I think what you might be able to do is to check that your contentOffset point is at the bottom of contentSize. So you could probably do something like:

    - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
        float bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height;
        if (bottomEdge >= scrollView.contentSize.height) {
            // we are at the end
        }
    }
    

    You'll likely also need a negative case there to show your indicator when the user scrolls back up. You might also want to add some padding to that so, for example, you could hide the indicator when the user is near the bottom, but not exactly at the bottom.

提交回复
热议问题