UIViewController.automaticallyAdjustsScrollViewInsets applies insets in view areas not consumed by accessory views

Originator:joshavant
Number:rdar://23666782 Date Originated:25-Nov-2015 03:01 PM
Status:Duplicate of 16788249 Resolved:
Product:iOS SDK Product Version:iOS 9.1
Classification:Serious Bug Reproducible:Always
 
Summary:
The official discussion of UIViewController.automaticallyAdjustsScrollViewInsets describes its behavior in the following way:
'allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar, navigation bar, and toolbar or tab bar'

But, for example, if you configure a UIViewController's .view with a scroll view subview positioned 'below' the top layout guide, UIKit will apply a top inset to the scroll view, despite the fact that the area which is being inset isn't 'consumed' by any of the given types of views, to begin with.

This seems like a documentation bug, at the least, but possibly even as much as an unexpected behavior bug.

Steps to Reproduce:
1. In Interface Builder, create a UINavigationController with a UIViewController root view controller.
2. Ensure the navigation bar is enabled (this is default behavior)
3. In the UIViewController, insert a top-level UIView subview which is pinned to the top layout guide and the superview leading and trailing, with some small, arbitrary constant height constraint.
4. In the UIViewController, insert a top-level UITableView which is pinned to the bottom of the previous subview, the superview leading, trailing, and bottom.
5. Ensure the UITableView subview is positioned below the UIView subview in the view hierarchy (since automaticallyAdjustsScrollViewInsets requires this configuration to have any effect - see rdar://23666075)
6. Configure the UIViewController to have the following options enabled:
Adjusts Scroll View Insets (i.e. automaticallyAdjustsScrollViewInsets)
Extend Edges Under Top Bars

Expected Results:
The UITableView DOES NOT have any top content inset (since the top area's y-origin is below the top layout guide, and none of it is 'consumed' by the navigation bar)

Actual Results:
The UITableView DOES exhibit a top content inset

Version:
iOS 9.1

Notes:
The attached sample project is configured in the state described. Notice the empty inset space at the top of the UITableView, which is applied automatically from enabling Adjusts Scroll View Insets (i.e. automaticallyAdjustsScrollViewInsets) and Extend Edges Under Top Bars.

Configuration:
iOS 9.1

Attachments:
'InsetBugSampleApp.zip' was successfully uploaded.

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!