Recently my app started doing scroll jumps when new ViewController was pushed like so:
I have tried different answers but nothing seems to work. I have learned that my app was setting negative offset to CGPointZero
after I have set:
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
self.tableView.scrollEnabled = NO;
}
I have tried to find what was setting the offset and I have learnt that setContentOffset it was invoked from:
UIScrollViewInternal _adjustContentOffsetIfNecessary.
All the answers that I found about this topics where suggesting to set:
self.automaticallyAdjustsScrollViewInsets = NO;
It did not work and it was driving me mad. Than I came across the answer suggesting the view hierarchy as the cause of some offset problems.
I was desperate so I tried moving this debug button from the top of the hierarchy like so:
weird jumping stopped.
Later I have learnt that your tableView should always be at the beginning of the view hierarchy so the autoadjustscrollinsets feature work properly and I have added:
[self.view sendSubviewToBack:self.tableView];
Just to be sure it always is because apple does not guarantee that it would not fiddle with .xibs hierarchy.