Tag: UIScrollView

  • Save current position in UIScrollView and then scroll to this position

    To save a position of the current scroll view use this method:

    - (void)savePosition {
        positionY = webView.scrollView.contentOffset.y;
        NSLog(@"positionY:%d", positionY);
    }
    

    To scroll programmatically to the saved position use this method:

    - (void)scrollToYPosition:(int)positionY {
        [self.webView.scrollView setContentOffset: \
    CGPointMake(self.webView.scrollView.contentOffset.x, positionY)];
    }