iOS - ContentOffset stays the same after changing size of UIScrollView

569 views Asked by At

I have an UIScrollView which have some content. My problem is that after I've changed the height of the scrollView, the contentOffset stays the same and therefore not showing the content it was previosly displaying.

For example, my scrollView have height 100 with contentOffset.y 50. I change the size of scrollView to height 200 and my contentOffset.y stays 50. I want it to follow the proportions and have contentOffset.y = 100.

Any ideas?

1

There are 1 answers

0
Yoav Schwartz On

After you make the change to the size you would have to calculate the amount to scroll and use either (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated or [self.scrollView scrollRectToVisible:frame animated:YES];