1

How can I find if the webview has been scrolled till the top or till the last?

What checks do I need to keep on scroll offset for these two cases and which function/ delegate menthod, do I need to check it so that I know that the user has scrolled till the end or till the top?

Actually I have to change the frame of UIWebview and other views in my screen for this purpose.

tech savvy
  • 1,417
  • 4
  • 21
  • 42

1 Answers1

1

Take a look at the UIScrollViewDelegate.

https://developer.apple.com/library/ios/documentation/uikit/reference/uiscrollviewdelegate_protocol/reference/uiscrollviewdelegate.html

Update

Here's an example:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    float scrollViewHeight = scrollView.frame.size.height;
    float scrollContentSizeHeight = scrollView.contentSize.height;
    float scrollOffset = scrollView.contentOffset.y;

    if (scrollOffset == 0)
    {
        // then we are at the top
    }
    else if (scrollOffset + scrollViewHeight == scrollContentSizeHeight)
    {
        // then we are at the end
    }
}
arturgrigor
  • 9,361
  • 4
  • 31
  • 31