Top and bottom layout guides have ambiguous horizontal constraints
| Originator: | arkadiusz.holko | ||
| Number: | rdar://15402294 | Date Originated: | 06-Nov-2013 |
| Status: | Closed | Resolved: | Duplicate of 14622013 (Closed) |
| Product: | iOS SDK | Product Version: | 7.0.3 (11B511 and 11B508) |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
With Auto Layout enabled topLayoutGuide and bottomLayoutGuide don't have correct horizontal constraints. I don't think it impacts the layout process, but it makes debugging ambiguous layouts harder.
Steps to Reproduce:
1. Create a new Single View Application project
2. Build and run it
3. Pause the program execution
4. In the lldb type:
po [[UIWindow keyWindow] _autolayoutTrace]
In my case it prints:
*<UIWindow:0x8e60e00> - AMBIGUOUS LAYOUT
| *<UIView:0x8e62270>
| | *<_UILayoutGuide:0x8e62450> - AMBIGUOUS LAYOUT
| | *<_UILayoutGuide:0x8e627f0> - AMBIGUOUS LAYOUT
5. Now use memory addresses of the layout guides to check their constraints with:
po [0x8e62450 constraintsAffectingLayoutForAxis:0]
It returns an empty array of horizontal constraints. It's the same for the other layout guide.
6. It also happens when Storyboards aren't used and everything is laid out in code.
Expected Results:
Top and bottom layout guides shouldn't be ambiguous.
Actual Results:
Top and bottom layout guides are ambiguous horizontally. They don't have any horizontal constraints set up.
Notes:
One workaround that I've found is to add:
NSDictionary *viewsDict = @{@"topLayoutGuide" : self.topLayoutGuide, @"bottomLayoutGuide" : self.bottomLayoutGuide};
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[topLayoutGuide]|" options:0 metrics:nil views:viewsDict]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[bottomLayoutGuide]|" options:0 metrics:nil views:viewsDict]];
in viewDidLoad/loadView.
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!