To save a position of the current scroll view use this method:
1 2 3 4 |
- (void)savePosition { positionY = webView.scrollView.contentOffset.y; NSLog(@"positionY:%d", positionY); } |
To scroll programmatically to the saved position use this method:
1 2 3 4 |
- (void)scrollToYPosition:(int)positionY { [self.webView.scrollView setContentOffset: \ CGPointMake(self.webView.scrollView.contentOffset.x, positionY)]; } |