Constraining to different attributes on a topLayoutGuide gives different results
| Originator: | lithium3141 | ||
| Number: | rdar://21213926 | Date Originated: | 02-Jun-2015 06:29 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | Xcode 6.3 (6D570) / iOS 8.3 (12F69) |
| Classification: | Other Bug | Reproducible: | Always |
Summary: UIViewController provides topLayoutGuide, a property which acts as a reference for Auto Layout constraints. It allows developers to position views relative to a particular line on the screen. However, this layout guide unexpectedly provides different positioning behavior when using different constraint attributes. Constraining relative to the bottom of the guide places views below it, as expected. Constraining relative to the top of the guide, by contrast, places views at the top of the container view controller's view – partially under the chrome the guide is meant to help avoid. Constraints relative to a topLayoutGuide should always align below the guide, never sometimes above it. The only public piece of information vended by a guide is its length: "the highest vertical extent for content that you don't want to appear behind a translucent or transparent UIKit bar (such as a status or navigation bar)," according to the documentation. It is confusing to establish any constraint relative to such a guide and still see content hidden behind these bars, as if the length doesn't matter. Steps to Reproduce: 1. Run the attached sample app. Expected Results: Both red squares are vertically aligned below the navigation bar. Actual Results: The red square on the left (constrained to the top of the top layout guide) is hidden behind the navigation bar. The red square on the right (constrained to the bottom of the top layout guide) is below the navigation bar. Sample code available at https://github.com/lithium3141/TopLayoutGuideConstraintsTest
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!