Questions regarding this issues has been asked. I tried everything and couldn't fix my problem. I struggled for 2 hours and now i am posting this here.
Issue: UIScrollView's top contentInset has always 20px extra space.
I have viewcontroller xib, not storyboard.
First, related question and its solution on stackoverflow assumes that UIScrollView is the root view of UIViewController. But my scrollview is not root view and hence that why maybe
self.automaticallyAdjustsScrollViewInsets = NO;
is not working
- I have one HeaderView with leadingspace(0, superview), trailing space(0, super view), top space(0, superview) and fixed height.
- Below header view is scrollview with leading space(0, superview), trailing space(0, superview), bottom space(0, superview) and vertical space(0, header view)
- There is a view inside the scrollview for contents. This view has leading(0), trailing(0), bottom(0) and top(0) space to scrollview.
Here is the screenshot of that extra 20 px top inset. Extra 20px is the black area between white line and light gray content of UIScrollView I am unable to get this fixed.

Am i doing something wrong? Autolayout constraints seems fine.