UIScrollView contentInsets are no longer set automatically

Originator:percysnoodle
Number:rdar://33287014 Date Originated:13 Jul 2017
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 11.0 beta 3
Classification:Severe bug Reproducible:Always
 
Summary:
Since iOS 7, a UIScrollView which is the content view of a UIViewController inside a UINavigationController has its contentInsets set automatically so that its content avoids the navigation bars.  In iOS 11, this is no longer the case; the contentInsets are zero.  Since the new contentInsetAdjustmentBehavior property defaults to UIScrollViewContentInsetAdjustmentBehavior, which is described in the documentation as "Automatically adjust the scroll view insets", I do not believe this is intentional.

Steps to Reproduce:
Create a view controller whose content view is a UIScrollView, and make it a child of a UINavigationController.

There is an example project which does this at https://github.com/percysnoodle/content-insets-bug-test

Expected Results:
The content should be positioned such that it does not underlay the navigation controller's navigation bar.

In the example project, the translucent navigation bar should appear green.

Observed Results:
The content should be positioned such that it does underlay the navigation controller's navigation bar.

In the example project, the translucent navigation bar appears red.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!