I was using adam's solution, but started to have problems when i was dismissing with animated:YES. In my code, content offset gets set a while after viewWillAppear (as viewWillAppear appears to be too soon).
- (void)viewDidDisappear:(BOOL)animated
{
self.scrollOffsetToPersist = self.scrollView.contentOffset;
self.scrollView.contentOffset = CGPointZero;
[super viewDidDisappear:animated];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[[NSOperationQueue mainQueue] addOperationWithBlock:^
{
self.scrollView.contentOffset = self.scrollOffsetToPersist;
}];
}
EDIT: another, better way is to reset it back in viewDidLayoutSubviews :)
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
if(!CGPointEqualToPoint(CGPointZero, self.scrollOffsetToPersist))
{
self.scrollView.contentOffset = self.scrollOffsetToPersist;
self.scrollOffsetToPersist = CGPointZero;
}
}