I have a view controller with a scrollview. This view controller contains a scrollview as the only child of self.view. When that view controller is modally segued, the view controller will display the scrollview as intended at top position. When that view controller is segued by push, the view controller will display the scrollview scrolled down to the bottom, which is not intended.
To rectify this, I tried this (In viewDidLoad) but both did not work:
[self setAutomaticallyAdjustsScrollViewInsets:NO];
or
CGPoint topOffset = CGPointMake(0, 0);
[self.patientenScrollView setContentOffset:topOffset animated:YES];
Why would the type of segue influence the scroll position? And how can I programmatically scroll to top? Or is viewDidLoad the wrong place to do scrolling? I am only interested in vertical scrolling...
You should add the code to scroll to the top in viewWillAppear
. animated
should be NO
.