I noticed that this code does not work as expected on iOS 11, because the value of the property adjusted byContentInset changes when the " navigationBar " is compressed while scrolling
CGFloat contentInsetTop=[scrollView contentInset].top;
if (@available(iOS 11.0, *))
{
contentInsetTop=[scrollView adjustedContentInset].top;
}
[scrollView setContentOffset:CGPointMake(0, -contentInsetTop) animated:YES];
... for example, it can start as 140, and then decrease to 88for a minimum scroll offset. This means that if you call it, it does not actually scroll to the very top.
Besides saving the original offset in memory from the moment it was loaded UIScrollView, is there a way to restore this value later to ensure that it really scrolls to the top sequentially, regardless of the adjustedContentInset parameter ?
source
share