No API exists to provide a custom top layout guide to the child of a custom container view controller

Originator:lithium3141
Number:rdar://19984939 Date Originated:27-Feb-2015 09:14 AM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.3 (12F5037c)
Classification:Other Bug Reproducible:Always
 
Summary:
UIViewController provides infrastructure for developers to build custom container view controllers, which can become the parent of other view controllers, add extra user interface, and provide organization and navigation in an app. UIViewController also has a read-only property topLayoutGuide, which – when called – returns an object whose length property indicates a vertical position to use for laying out the logical top of that controller's content.

However, it seems these two cannot mix: an implementation of a custom container view controller has no way to propagate a nonstandard top layout guide or length to its child view controller(s). -topLayoutGuide is intended to be invoked by and on the child, not the container, so the container cannot override its implementation and expect that to affect the child's behavior. What's more, as a readonly property, the container cannot set a custom top layout guide object on its child (say, when the child moves to its new parent view controller).

The documentation for -topLayoutGuide seems to implicitly address this fact. For child view controllers inside containers, it gives three possible cases for the constrained value of the layout guide's length: a visible navigation bar, a visible status bar, or no visible bar. It does not give more generic information, discuss custom containers, or explain how the "container view controller constrains the value."

Please provide a way for a custom container UIViewController to propagate a nonstandard topLayoutGuide to its child view controller(s).

Steps to Reproduce:
1. Build a new custom container UIViewController. Add additional chrome at the top of this controller's view.
2. Add a child UIViewController to that custom container.
3. Attempt to express the height of the additional chrome to the child by way of -topLayoutGuide.

Expected Results:
API exists for the container to constrain a custom top layout guide at the bottom of its additional chrome and make that guide available to its child.

Actual Results:
No such API exists. The child's topLayoutGuide will likely have a length of 20 or 0, depending on whether the status bar is visible.

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!